-
I host my site via Cloudflare. When you type in my domain,
llmilne.com
, into a web browser, it takes you to my site, however, if you click on a post, it takes you tohttps://e1936226.llmilne-com.pages.dev/
. How do I fix it? -
How do I put my posts under
https://llmilne.com/*
instead ofhttps://llmilne.com/posts/*
? I’ve tried what I believe is everything in the wiki to no avail. My config is config.yml, if that helps?
- I cloned your repo and the Hugo site builds just fine, all links use the set baseURL. The issue must be with your Cloudflare pages setup. My guess is that you set “–baseURL” to some value in the Cloudflare build script.
- You have all the content files inside the subdir “posts”. https://gitlab.com/m1ndlux/llmilne.com/-/tree/main/content/posts. Move “about.md” etc. up one level and you get URLs like
https://llmilne.com/about/
instead ofhttps://llmilne.com/posts/about/
Hugo assumes you are intensional about the dir structure inside content. You can override it when needed but I rarely use that.
I cloned your repo and the Hugo site builds just fine, all links use the set baseURL. The issue must be with your Cloudflare pages setup. My guess is that you set “–baseURL” to some value in the Cloudflare build script.
Surprising. I have no idea what to do. I’ll look around a little.
EDIT: OK, fixed this! Thank you a TONNE!
You have all the content files inside the subdir “posts”. content/posts · main · mindlux / llmilne.com · GitLab. Move “about.md” etc. up one level and you get URLs like
https://llmilne.com/about/
instead ofhttps://llmilne.com/posts/about/
I did that, when I revisit my site, all my posts disappear.
You mean that they are not listed on the front page I assume.
This is because the theme you are using use “.params.mainSections” to pick what section(s) to list on the front page.
If you want to list the base pages on the front page you will need to override that.
Ahh, thank you.
If you want to list the base pages on the front page you will need to override that.
DO you know how I might be able to do this?
in config.yml
add mainSections: posts
under params,
looks like this
params:
mainSections: posts
if you have more than 1 section
params:
mainSections:
- writing
- posts
- etc
That didn’t change anything. Sorry if this is a skill-issue or something, but is there something I’m not getting?
You need to override this template:
Thank you. Do you mind helping teach me how to do so?
First question: why do this at all?
content/
├── about.md
├── donate.md
├── feed.md
├── my-first-post.md
├── privacy-policy.md
├── resume.md
├── search.md
└── tags.md
You already have links to most of these in your menu:
And “my-first-post.md” is clearly a different/specific content type (a post), so it belongs in something like “content/posts”.
Spend a few minutes thinking about your content model before making a bunch of changes to the theme templates.
Well, I wasn’t particularly asking you to comment on my design choices, but regardless, those tabs redirect to my .md posts. Ideally I’d remove About.md, Search.md, Donate.md, Tags.md, and RSS.md, from the home page, and have those tabs direct you to the relevant “posts”, just these posts are inaccessible from anything but the tabs and typing in the URL, if that makes sense? Sorry, I’m not great at explaining. Point is, I haven’t done that yet because I can’t work out how, but I really haven’t tried too much yet, I was moreover focusing on the items listed in my post for now.
mkdir layouts/_default
cp themes/PaperMod/layouts/_default/list.html layouts/_default/
Then edit layouts/_default/list.html
And change this:
{{- if .IsHome }}
{{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- $pages = where $pages "Params.hiddenInHomeList" "!=" "true" }}
{{- end }}
To this:
{{- if .IsHome }}
{{- $pages = site.RegularPages }}
{{- $pages = where $pages "Params.hiddenInHomeList" "!=" "true" }}
{{- end }}
This will include every regular page when rendering the page collection on the home page, unless you set hiddenInHomeList: true
in front matter.
OK, that was incredibly helpful, thank you a tonne. Do you happen to know how to help with this:
Ideally I’d remove About.md, Search.md, Donate.md, Tags.md, and RSS.md, from the home page, and have those tabs direct you to the relevant “posts”, just these posts are inaccessible from anything but the tabs and typing in the URL
?
If you can’t be assed, I don’t blame you. You solved the posted problem, have a good day.
I don’t understand. Do you want to remove the menu items in the upper right?
No, I want to exclude the tabbed pages from appearing in the home menu.
Sorry, I do not think we are communicating very well. Perhaps you could diagram what you would like?
Good idea, however I’m not too sure what to diagram to explain it any better, so I’m going to try explaining it one more time.
I want, for example, “about.md” (and all the other tabbed pages) to be removed from my list of pages on the home menu, and only accessible by clicking on the tab.
Slightly better?
When you say tabbed pages, do you mean the horizontal menu in the upper right?
When you say home menu, do you mean the list of content on the home page?
Literally the exact opposite of this.
Yes and yes. Sorry, I should have clarified earlier.