Two questions:

First, change your menu definition in config.yaml. Use pageRef instead of url, and place the slash at the front of each path instead of at the end of each path.

        menu:
            main:
                - name: About
                  pageRef: /about
                  weight: 1
                - name: Videos
                  pageRef: /videos
                  weight: 5
                - name: Search
                  pageRef: /search
                  weight: 10
                - name: Donate
                  pageRef: /donate
                  weight: 11
                - name: Tags
                  pageRef: /tags
                  weight: 12
                - name: RSS
                  pageRef: /feed
                  weight: 15

Second, modify layouts/_default/list.html, starting at line 43:

{{- if .IsHome }}
  {{- $menuPages := slice }}
  {{- range site.Menus.main }}
    {{- $menuPages = $menuPages | append .Page }}
  {{- end }}
  {{- $pages = site.RegularPages | complement $menuPages }}
  {{- $pages = where $pages "Params.hiddenInHomeList" "!=" "true"  }}
{{- end }}

This builds a slice of the pages that appear in the menu, then subtracts those pages from site.RegularPages using the complement function.

1 Like

Or you could add hiddenInHomeList: true to the front matter of the pages that you want hidden in the home list. If you choose to do this instead, still make the menu changes as shown above. A number of theme authors are still providing examples using the url property for internal links instead of the pageRef property, but that is not the idiomatic way to do it (and will cause subtle problems under certain conditions).

And going back to my earlier comment about content modelingā€¦ it would be much simpler to place the non-menu pages (resume, privacy policy, my first post) in a subfolder (posts, articles, whatever). Then on the home page just iterate over that content type (ā€œpostsā€, ā€œarticlesā€, whatever).

1 Like

So, I tried both those approaches, and nothing seemed to have changed, so I tried to hugo server and I got the error Error: add site dependencies: load resources: loading templates: "/home/mindlux/Documents/git/llmilne.com/layouts/_default/list.html:114:1": parse failed: template: _default/list.html:118: unexpected {{end}}. I reset that file back to how it was after we first changed it, and I got the same error, just with 114 instead of 118, because obviously I didnā€™t add the extra four lines you gave me.

Sorry, I hit the new user reply limit. Had to weight seven hours.

I donā€™t post untested code. Try it:

git clone --recurse-submodules https://github.com/jmooring/llmilne.com
cd llmilne.com
hugo server
1 Like
Start building sites ā€¦
hugo v0.111.3+extended linux/amd64 BuildDate=2023-07-26T00:00:00+00:00 VendorInfo=Fedora:0.111.3-4.fc39
Error: Error building site: failed to render pages: render of "home" failed: "/home/mindlux/Documents/llmilne.com/layouts/_default/list.html:46:34": execute of template failed: template: _default/list.html:46:34: executing "main" at <append .Page>: error calling append: reflect: call of reflect.Value.Type on zero Value
Built in 47 ms

Sorry, hit the daily maximum amount of replies a new user can make. Itā€™s midnight now.

Please use v0.115.0 or later, preferably the latest release (v0.121.2).

https://gohugo.io/installation/linux

1 Like

I updated my Hugo version. Mine gave me the same error as before, while yours worked perfectly fine.

After running the diff command, the result is:

1c1
< {{- define "main" }}
---
> {{ "main" }}

This wonā€™t work:

{{ "main" }}

So change it back to what it was.

1 Like

I never changed that line. the only line I changed in the entire file was line 43 to 50 as mentioned earlier, however, I changed my file to exactly what yours said for line 1, and it worked fine. Iā€™m not sure if thatā€™s what you meant, but my website looks exactly how I wanted it to look, so yeah, thanks. Marking as solved.

One more question because itā€™s easier to get them all out whilst I have someone who knows what theyā€™re doing, do you know how to make it so that when you click my name in the top left, it doesnā€™t select any of the ā€œtabsā€ automatically (it currently selects ā€œVideosā€ as indicated by the underline)? And how I can customise the ā€œVideosā€ page, so that where it says: ā€œIlluminating peoplesā€™ thought processes.ā€ I can write something different like: ā€œThis is the videos page.ā€ For example?

Basically, what I want (if it makes sense) is:

Home page (the page it brings you to upon clicking my name in the top left) no ā€œtabā€ is highlighted, URL is https://llmilne.com/ and the blurb says ā€œIlluminating peoplesā€™ thought processes.ā€

Videos page (the page it brings you to upon clicking on the Videos tab on the top right) ā€œVideosā€ ā€œtabā€ is highlighted, URL is https://llmilne.com/videos/ and the blurb says ā€œPlaceholder.ā€

Do you know how I can do that?

You need to create a videos page, and make sure draft is set to false.

hugo new content videos.md
---
title: "Videos"
date: 2024-01-07T19:28:19-08:00
draft: false
---

Whatever...

Then change your menu entry from this:

- name: Videos
  pageRef: /v
  weight: 5

to this:

- name: Videos
  pageRef: /videos
  weight: 5

Please open a new topic if you have further questions. Iā€™m a bit fatigued by this one.

1 Like

No, that was perfect, and Iā€™ll stop now. Mate, I wish you the most wondrous day. thanks a tonne.

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