Greetings,
I have recently discovered Hugo, and am now studying and testing it to see if I can rebuild with it some websites I have (some static, some in LAMP CMSes).
So far, unless I missed something, there one thing that I don’t understand, and don’t like. I found this issue building the home page, but I’d want to do what follows with many other pages.
I want a home page that is a fixed “welcome” paragraph, followed by a list of the latest N posts I published, which have a certain flag set in the frontmatter. I managed to do this by writing the welcome into a separate HTML file, and this into the index.html file:
{{ partial "welcome.html" . }} {{ range last 10 (where .Data.Pages.ByDate ".Params.onfrontpage" "true")}} <li> {{ .Date.Format "2006/01/06" }} - <a href="{{ .Permalink }}">{{ .Title }}</a> </li> {{ end }}
But… Do I really have to write stuff like that into an HTML file, instead of a .md file? If I write the same Hugo commands into an .md file they are not processed., and this is the thing I don’t understand.
Theme and pages layout are one thing, actual content another, even if it is not static. Why write content inside layouts, that are something else? Or why write pure static content (the “welcome” part in my example) in HTML instead of markdown? Can I put generic Hugo commands like the list generation above in a generic .md file, in a way that Hugo will process it correctly, even though it is not inside an HTML template/file?
For the record, before posting this I have searched this forum, and found and read these discussions (no links, sorry, the system says that being my first post I’m not allowed to post links…);
- “Allow home page to be easily authored in markdown”
- “allow inclusion of other content in a content file”
Being still new to Hugo, however, I confess I have not understood if what I am asking is possible with the current version of Hugo, and if yes how.
Thanks in advance for any help!
M.