To create a new landing page, is adding .html file to layouts folder enough?


I am looking at Meghna theme.

I wanted to add a new landing page and added a new ‘message.html’ file in the layouts folder.

(I copied the existing 404.html file in the same folder and modified it minimally to add a new paragraph)

Should this be good enough to generate message.html in the Public folder when I run the Hugo command? Or, do I need another step to tell Hugo to generate message.html from the layout file?

Is message.html static or does it contain template code?


Here is message.html. I believe the inclusion of partial makes it a template code?

{{ define "main" }}

{{ partial "navigation.html" . }}

<section class="section">
  <div class="container">
    <div class="row">
      <div class="col-12 text-center">
        <h1>Thank you!</h1>
        <h2>Thank you for reaching out, we will contact you shortly.</h2>
				<a class="btn btn-main" href="{{ site.BaseURL | relLangURL }}">Back to home</a>

{{ end }}

Inclusion of any {{ foo }} makes it template code.

Place message.html in layouts/_default.
Then create a content page to use that layout. For example…


title = 'Foo'
date = 2022-08-11T11:01:58-07:00
draft = false
layout = 'message'
1 Like

Thank you, I tried it as you had indicated a few times, but, a new file was not generated.
As a work around, I have created an html file (edit by hand) and deployed, the edit path worked.

I not sure what you did, but you did it wrong. Try it:

git clone --single-branch -b hugo-forum-topic-39951 hugo-forum-topic-39951
cd hugo-forum-topic-39951
hugo server

Thanks for sharing, I tried yours and I see how it works. I noticed one thing that might make a difference. Themefisher classifies the theme I have as a Bootstrap Template … is this different from a Hugo Theme?


Yes, they are two different things. Some of their Hugo themes may leverage the Bootstrap library, but that’s a question for Themefisher.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.