Hi,
I am new to Hugo and I am having issues with _index.md
. I am trying to build a simple website (not a blog) for a hotel and creating my own theme along the way.
So far the themes/hotel/layouts
folder contains:
layouts/index.html
layouts/_default/single.html
layouts/partial/header.html
layouts/partial/menu.html
layouts/partial/footer.html
and the contents
folder contains:
contents/_index.md
contents/rooms/_index.md
contents/rooms/single.md
contents/rooms/double.md
contents/contact.md
At the end I want the HTML pages to be created to be:
public/index.html
public/rooms/index.html
public/rooms/single/index.html
public/rooms/double/index.html
public/contact/index.html
In the theme’s menu.html
template (included using partial in index.html
and single.html
), I am trying to add a link to all the pages of the website. This works:
<a href=“{{ relref . “contact.md” }}”>Contact
<a href=“{{ relref . “rooms/single.md” }}”>Contact
but I don’t manage to get a link to the pages created from _index.md
:
<a href=“{{ relref . “_index.md” }}”>Homepage
<a href=“{{ relref . “rooms/_index.md” }}”>Our rooms
returns an error "error calling relref: No page found with path or logical name “_index.md”.
I read the doc and some of the posts here regarding “_index.md” but there is clearly something I don’t understand so I would be grateful if someone could shed some light on this for me.
Also if there is a particular section of the documentation or a particular theme that could be useful for the kind of website I am trying to build, please let me know.
Many thanks for developing Hugo!