I’ve had to change the theme of my site from Icarus due to problems with redundant dependencies on Google News, and now I’ve chosen the m10c
theme.
I cannot work out, however, how to make changes to the main page of the site. Something is clearly generating index.html
but I cannot find an index.md
or anything that looks as if it might be involved.
Is it something that is particular to the theme, or is it a fundamental part of Hugo itself?
content/_index.md
is the home page.
Thanks for the reply! I’m still confused because until 2 seconds ago, I haven’t had an _index.md
or indeed an index.md
anywhere on my hugosite
folder. I’ve just added one with hugo new
and run hugo
but the page is still displaying with an index.html
which is being generated from somewhere, but I cannot see where!
public/index.html
is generated whether you have content/_index.md
or not. It is generated by a template—which template is determined by the theme. Here are the candidates:
https://gohugo.io/templates/lookup-order/#examples-layout-lookup-for-home-page
It seems that in this case it is layouts/_default/baseof.html
that is acting as the template for the main index page. I made a small change and it was rendered. However, the links to my existing posts have all vanished…
UPDATE: I rescued the situation by doing a git clone
on the theme, again. but this doesn’t answer the question of how I can make changes to the main page, without losing the links to my existing pages…
So, at this point…
You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.
See Requesting Help.
Let us see your code
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.
Your repo is a bit of a mess, a mix of old and new.
If I were you, I would start from scratch, then copy the old content to the new project.
1) Create new site
hugo new site foo
cd foo
git init
git submodule add https://github.com/vaga/hugo-theme-m10c themes/m10c
echo "theme = 'm10c'" >> config.toml
hugo new _index.md
hugo new about.md
hugo new posts/post-1.md
hugo new posts/post-2.md
hugo server -D
The content you just added will have draft
set to true
. Either change all to false
, or run hugo server
with the -D
flag.
2) Add some menu items and params to your site configuration.
config.toml
[[menu.main]]
name = "Home"
pageRef = "/"
weight = 1
[[menu.main]]
name = "Tags"
pageRef = "/tags"
weight = 2
[[menu.main]]
name = "About"
pageRef = "/about"
weight = 3
[params]
author = "John Doe"
description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
menu_item_separator = " - "
3) Add your own avatar (static/avatar.jpg
).
4) Override the home page template. Do not modify files in the themes directory.
mkdir layouts/_default
cp themes/m10c/layouts/_default/list.html layouts/_default/home.html
Thanks for the reply, Joe!
Your repo is a bit of a mess, a mix of old and new.
That’s what happens if you leave a site for 5 or 6 years and just expect to pick up where you left off, I guess!
If I were you, I would start from scratch, then copy the old content to the new project.
That’s a great idea! As you saw, the site was not very big so this wouldn’t be a great hassle, and it gives me the chance to move forward and get things in line.
At the risk of embarrassing you, may I add my name to the list of many people who have expressed their appreciation of the work you do on this forum?
1 Like
I’ve followed your instructions to the letter, but I am getting a build error…
~/hugo/carlca ❯❯❯ hugo server
port 1313 already in use, attempting to use an available port
Start building sites …
hugo v0.111.3+extended darwin/arm64 BuildDate=unknown
Error: Error building site: render of "404" failed: "/Users/carlcaulkett/hugo/carlca/themes/m10c/layouts/_default/baseof.html:23:20": execute of template failed: template: 404.html:23:20: executing "404.html" at <.Site.Menus.main>: error calling Menus: runtime error: invalid memory address or nil pointer dereference
Built in 6 ms
Both my site and your test site have identical content for 404.html
and _error_404.scss
, so I’m guessing that the error might be something to do with the [[menu.main]]
commands…
UPDATE 1: I deleted the 3 [[menu.main]]
commands from config.toml
and then reran hugo
. This time, the site built but when I ran it, the first thing I saw was the 404
page!
If I then reinstate any one or more of the [[menu.main]]
commands, the build fails.
I then figured that maybe I had to tailor the [[menu.main]]
commands to suit my existing pages, but I haven’t managed to build successfully yet…
UPDATE 2:
Panic over! The mistake I made before was to overwrite my new content files with the old ones, rather than copying in the content.
I’ve also re-added the [[menu.main]] commands and they work fine.
Hi @jmooring, I’m pleased to announce that the site, such as it is, is live and can be reached at https://carlca.com. I’m going to have a rest from Hugo matters for a few days, and get back to some Java coding and some music making.
I do have a couple of questions about the site in its present state. Firstly, the extra pages I added with the [[menu,main]] commands are not resulting in actual pages. Closer inspection of the resulting source code reveals the links to be empty HREFs…

Did I forget to do something here?
Also, although I have control over the message under the menu “links” via the config.toml
, there doesn;t seem to be a way to include a link in there. I would really like the “Bitwig” text to be a link to https://bitwig.com, but I have tried embedding a full HREF in the text as well my most recent attempt to mimic the way that the copyright message works…
If you, or anyone else, could shed some light on these two puzzles, I would be really grateful!
Please post your menu entries from your site config file.
[[menu.main]]
name = "Home"
pageRef = "/"
weight = 1
[[menu.main]]
name = "Tags"
pageRef = "/tags"
weight = 2
[[menu.main]]
name = "About"
pageRef = "/about"
weight = 3
[[menu.main]]
name = "CoC"
pageRef = "/coc"
weight = 4
UPDATE:
I’ve now created new pages corresponding to the menu items…
~/hugo/carlca ❯❯❯ hugo new tags.md
Content "/Users/carlcaulkett/hugo/carlca/content/tags.md" created
~/hugo/carlca ❯❯❯ hugo new about.md
Content "/Users/carlcaulkett/hugo/carlca/content/about.md" created
~/hugo/carlca ❯❯❯ hugo new coc.md
Content "/Users/carlcaulkett/hugo/carlca/content/coc.md" created
Now, the tags
link leads to the empty tags.md
page being loaded but the about.md
and the coc.md
pages are not loaded by the about
or the coc
links. Also when one does a mouse over on the tags
link, it show the correct URL of localhost:57793/tags
whereas the other links do not show the correct URLs.

About and CoC have empty href
atrributes because there are not corresponding pages in your content directory. I just cloned your repo at 12:57 -08:00.
Remove this file. No no no.
I pust pulled changes:
content/
├── posts/
│ ├── git.md
│ └── markdown.md
├── about.md <-- change draft to false
├── coc.md <-- change draft to false
└── tags.md <-- delete this
I’ve just ensured that pages have draft set to false and I deleted the tags page - I assume this is a special case in Hugo…
The site as run on my local server runs perfectly, and the HREFs are fully formed…

Exactly the same build as running on Netlify is not behaving the same, and the HREFs are empty…

Admittedly it’s getting late here in London, but I’ve checked several times to make sure the same build is running locally and at Netlify, but it is behaving differently. What am I missing?
When I visit the live site and view source…

Netlify is building your site with v0.85.0. You need to change that.
See my previous response.