What's the point to implement many blogs?

[Domain]/blog1
[Domain]/blog2
[Domain]/blog3

Following another topics, I have created a them with an index which is nourished by /layouts/index.html and a blog1 structured by /layouts/_default/list.html

Now, how the 2nd blog should be structured? which file should handle it?

What exactly are you trying to accomplish? Should every blog be rendered different? If yes, then you can create folders under layouts which are named the same as the section, i.e. blog1, blog2, blog3. In those folders you can then create your templates, for example list.htmland single.html. When rendering the page, hugo will notice those layout folders and use them correctly for your sections.

Ah, such a nice approach. Thanks for the help.

And also blog1, blog2, blog3 folders in /contents, right?

@internetfreak wrote: What exactly are you trying to accomplish?

A series of blog under one domain for the family: my father, mom, myself and my sister. Each one has a different Bootstrap layout. For example, my little sister’s blog is just a gallery for her drawing and photos, a portfolio template.

Glad I was able to help :slight_smile:

In your case, that would be true. Sections in Hugo are basically folders inside of content. For example if you want a section blog1 you create a folder called blog1 in content. If you later want to add a subsection of this blog with a URl of blog1/subsectionyou create a subfolder of blog1 with the name subsection. To specify custom layouts for all sections, you then replicate the same structure inside of /layouts where you can then add your template files for the sections. See the Documentation for more details about that.
One note: do not forget to configure the permalinks for each section. Again, the Documentation is your friend :slight_smile:

As for your general approach, wouldn’t it be better to create multiple pages which are then processed by hugo? Each page can be configured separately, have it’s own theme etc. After building the site you can then copy all files to your web host and use it under one domain. If you have any problem, feel free to post so we can help you

1 Like

It’s working, it’s working. Thanks man.

As for your general approach, wouldn’t it be better to create multiple pages which are then processed by hugo?

Do you mean some fully separated weblogs? Indeed, I’m merging theme because of common elements. They have same topbar, navbar, footer and sidebar. For example, mine and my father weblog have same same sidebar. If I separate them, when I want make a change in (i.e) menu, I should change the navbars for all weblogs.

Is there any trick to separate categories too? something like this:

[Domain]/blog1/categories: A, B, C
[Domain]/blog2/categories: D, E
[Domain]/blog3/categories: F, G, H, I

‌ ‌
‌ ‌
Currently it mixes theme:
[Domain]/categories: A, B, C, D, E, F, G, H, I

‌ ‌
‌ ‌___________________________
A part of the config.toml:

[permalinks]
    blog1             = "/:section/:title/"
    blog2             = "/:section/:year/:month/:title/"
    common            = "/:title/"

[taxonomies]
    tag               = "tags"
    category          = "categories"
1 Like

As far as I know there’s currently no way to achieve this with the native taxonomy function which hugo provides as it collects all taxonomy terms as single collection. With a bit of extra work you could probably “emulate” that feature because hugo allows you to override and control things as you like. Below I have written a guide how it could be achieved but please not that this guide is not tested so it could require more work as I thought or even might not work at all.
It would be probably useful to know how to assign and use variables inside of templates, some things will be easier then.

How to achieve separate taxonomies under a shared term:

What you probably could do is to define unique taxonomies for each blog so you have a collection of terms for each blog. I recommend something like blog1Categories as it will make things a bit easier later.
Then create a new section categories for each blog direcly under content/$blog/. Example of the resulting path: content/blog1/categories.
Now create a file called _index.md inside of each of the new folders. You need that file to override the layout variable via front matter because normally hugo would try to use a layout under $blog/categories but I assume you rather want a shared layout and only separate categories for each blog. Refer to the documentation to see on how to override destination paths
The only step you now need to do is to create the shared layout. Inside of that layout you need to determine the taxonomy collection you need to render. This should be pretty easy to do as you only need to get the .Parent of the section, append Categories to it and then you can retrieve the collection from .Site.Taxonomies and render your collection as you wish.

2 Likes

A bit confusing, but I’ll try to implement it as far as I can. Thanks for the detailed answer.