Adding feature to set any page as the home page?

This is a common functionality in many CMS.
It is often interesting to switch your home page temporarily for displaying an important message or support a timeframe campaign.

Also in a hugo environment it would help solve issues related to

  • Setting a custom layout to the home page
  • Adding Page Bundle ability to the home page

I’m just opening a conversation to discuss feasablity, specs etc…

I am using Data Files for the Home page. It works great for quick changes.

1 Like

I use a partial that I markdownify that is embedded into the index.html.

{{partial "homepage.html" . | markdownify }}

Then just write in markdown within the homepage.html.

1 Like
1 Like

In addition to this; Hugo is a static site generator – and there are plenty of ways to change home page … file copy etc.

But it implies changing the theme’s code, I cannot replace the content directory’s with another file and expect everything to play along template wise ? Or can I?

Of course it is not a problem with my personal blog, but on a bigger project it means the content department cannot easily decide to temporarily change the home page without opening a ticket to their IT nemesis (I know people from both side ;)).

Joke aside, I just think it’s an interesting feat in the long run, I’m fine without it for now.

@bep I guess the commit makes it possible to set a custom layout for the home page but I was not able to understand how.

I do too! Or you can already use Front Matter.

I’m talking about a situation where you need a blog article or a statement page to be on there for a short period of time using their respective templates and without having to change the theme code.

That is a documentation issue. Someone should fix that.

Believe me, there are more than enough was to get what you want. Or, we’re not adding more …

Currently I have a set of 3 predefined CSS layouts. Each one is triggered by adding a tag in a data file.

Also if I want to render a content file I add a featured tag in that file.

Having pre-designed elements and loading them on demand can be done already.

Of course I’ll believe you, I’ll try and figure out how.