Michael
Michael

Reputation: 2993

How do I make a home/landing page in markdown with Hugo?

Look, Hugo is for writing static (and blog) sites in markdown. GREAT! How do I create the home page (i.e. not the home post)?!

By home page I mean I want to have some markdown file rendered in my theme at the root: http://example.com/, not http://example.com/home (I will change themes if necessary, but I'm currently using hugo-nuo).

Here's how I'm trying to do it:

add my own layouts/index.html (overriding the theme's)

{{ define "main" }}
  {{ partial "header.html" . }}
  <section class="main">
    WHERE I WISH I COULD IMPORT home.md OR SOME SUCH, HECK I'D BE ALRIGHT JUST PUTTING MARKDOWN HERE
  </section>
  {{ partial "footer.html" . }}
{{ end }}

This incredibly long thread seems to discuss a bunch of issues that've been addressed, but I don't see this answer.

This answer says to use shortcodes. I'm willing to do that, but it looks like shortcodes can only be used from within content (citation needed).

Upvotes: 3

Views: 2023

Answers (1)

HansQ
HansQ

Reputation: 410

You can add a _index.md into the folder content/ and access it, e.g. via {{ .Content }}.

Upvotes: 3

Related Questions