Hello,
I’m new to hugo
i try to use i as an cms and not as an blog engine.
everything works fine, but i want to have an index.md
that renders “/” as single page and not as list of posts
With the current version of Hugo, everything is a page. So, you can do this with your source organization:
.
content/
_index.md
Note Use _index.md and not index.md. This will be the content and front matter for your homepage now. Once you have content added to this page, you can call it in the layouts/index.html template the same way you would any other individual content file via {{.Content}}. If you have errors with this approach, I would recommend filing an issue on the theme’s github repository. It looks like it hasn’t been updated in a while…since it requires only v14 of the HUGO to run.
The home page has a separate template, index.html in the theme folder.
single.html and list.html are used for rendering the content of the subfolders of your content directory.
The way index.html is set up in this theme is to give a list of posts ({{ range .Data.Pages }}) so it does not read your _index.md at all as it looks through all your other content pages and puts this in the homepage.
So I would try to change the index.html template file (/themes/hyde/layouts/index.html) to:
Yes, supplied themes are just for “standard use”.
I started to use Hugo for a “blog section” of my home page, but recently I set up a theme for the complete website with a set of “normal pages” as well as a blog section on top.
So as I read through the docs and this forum and get things working slowly I try to write a german language tutorial in the blog section. Maybe this may help others - but it helps me structuring the information and understand hugo …
The first comment is semi-correct and the second comment is incorrect.
To piggyback on what @ominty just said, you should create your own index.html file, but do it in your root project directly and not in the theme directory. The lookup order will privilege your index.html template over the theme’s index.html template. This is by design and for very good reason: you are able to override the theme templating while still keeping compatibility with the upstream of the theme.
So, instead of making the recommended layout at /themes/hyde/layouts/index.html, just make it at /layouts/index.html.
If you are not finding that you can access {{.Content}} while running hugo, the first thing is to make sure you are running the latest version via hugo version.
[quote=“rdwatters, post:8, topic:5533”]
you should create your own index.html file, but do it in your root project directly and not in the theme directory. The lookup order will privilege your index.html template over the theme’s index.html template.
[/quote]explicit consent
… and sorry for not thinking about that. That’s because I try to set up my own theme from scratch and so I’m working in the /themes directory all the time …
Ah! Thank you so much @ominty . I am new to Hugo as well and I was having the exact same problem with the theme hyde-hyde (which is derived from hyde).
I spent hours and hours searching until I found your post .
This worked beautifully.
Note: as pointed out by @rdwatters, I did not edit the theme, but created my copy (following advice I had found here before finding this forum).