- There is a page in the template I’m using(layouts/contact/list.html), and I’m not sure how is it called: it can be called by the name ‘contact’ while it’s actual name is list.html. If I rename it to anything else - it can not be found. So, I suppose it should be registered somewhere in Hugo with the name ‘contact’ - but where, please tell me where to read about that registry.
- How should I create a new page - it’s not a content page, but a page with some functionality. I’d like to call it e.g. upload_content.html, and be able to call it from the menu. I’m going to have there a submenu. There will also be some content taken from a file in Data directory. Where and how should I register it and place it so that it would be found by Hugo?
So everything in
layouts is called based on content types.
So if you have a content type called
contact, it will use
/layouts/contact/ as its default.
That means you have type of content called contact.
IE, your content folder looks like this:
content ├── _index.md // <- https://example.com └── contact ├── _index.md // <- https://example.com/contact/ ├── page-one.md // <- https://example.com/contact/page-one/ └── page-two.md // <- https://example.com/contact/page-two/
If you’re looking to make a layout for a contact page, you just need to make a
contact.html file in your
Hi bootyocean18, thanks for the info. the page in the contact folder in my template is called list.html, and it bears no content - it is a page that provides a functionality of sending an email. It uses no html template, it has its own html code.
I want to create a new page with its own functionality, but so far can’t make Hugo see it.
A similar question has been asked about 24h ago:
And the answer given there is the same as the one @bootyocean18 gave you here: You need to separate content (Markdown) and template (HTML). Hugo will not simply “see” an HTML page somewhere that doesn’t fit its content model.
bootyocean18 and chrillek, thank you very much for the explanation! I see that:
to post a new page I should either create a content/dir_name/index.md, indicating in it a certain template to use, or also create a layouts/dir_name/single.html template for it.
You want a CONTACT FORM page.
You need to create the following files:
/content/ make a file called
/layouts/ create a file called
contact.html should contain your form and form logic.
contact.md should contain the following:
--- title: Contact Me! --- Any additional *Markdown* content here that you want to display on the page!