Basic question

Hello. I’m working on creating my basic Hugo site using Ananke. Trying to build functionality bit by bit (pun intended). I’m working to create a Contact page, and have followed this file structure. I get the contact page with some markdown, but I do not get the html form in the layouts folder. Here is what I have.

Welcome here - Two points:

  • Without showing more information on code/config/scripts all is guessing what you have. Please spend some time and read Requesting Help
  • looks like you directly mess with the themes folder from ananke.
    That’s not what you should do. for adding or customizing layout templates use the layouts folder in the ROOT of your project. (see structure below)

That said,

guessing what you have, without really understanding that sentence there are two options:

here it is

follow Template Lookup-order | Target a template to create a special template for your contact file :

content/contact.md

+++
title = 'Contact'
layout = 'contact'
+++
Get in touch

layouts/page/contact.html

<h1>This is the contact layout</h1>
<h2>{{ .Title }}</h2>
{{ .Content }}

and you will be rewarded with a Contact page here: public\contact\index.html http://localhost:1313/contact/

Customizing themes

  • add new layouts, files, assets… to your project structure
  • for changes just copy the file from the theme to the same place in your project folder and adjust to your need. Don’t mess with then theme files.
PROJECT_FOLDER             <- your files 
¦   hugo.toml
+---archetypes
¦       default.md
+---content
¦       contact.md                     <-- your contact content file
+---data
+---i18n
+---layouts                            <-- add or customize the theme HERE
¦   +---page
¦           contact.html               <- your contact layout file
+---static
+---themes
    +---ananke              <- Theme files: don't touch the stuff below
        ¦   ....  
        ¦       
        +---assets
        +---config
        +---i18n
        +---images
        +---layouts
        ¦   ¦   404.html
        ¦   ¦   index.html
        ¦   ¦   robots.txt
        ¦   +---page
        ¦   ¦       single.html
        ¦   +---partials
        ¦   ¦   ¦   author.html
        ¦   +---post
        ¦   ¦       list.html
        ¦   ¦       summary.html
        ¦   +---shortcodes
        ¦   ¦       form-contact.html
        ¦   +---_default
        ¦           baseof.html
        ¦           list.html
        ¦           single.html
        ¦           summary-with-image.html
        ¦           summary.html
        ¦           taxonomy.html
        ¦           terms.html
        +---static
            +---images
                    gohugo-default-sample-hero-image.jpg                 

→ content/contact.md

1 Like