rhazdon / hugo-theme-hello-friend-ng

Pretty basic theme for Hugo that covers all of the essentials. All you have to do is start typing!
https://github.com/rhazdon/hugo-theme-hello-friend-ng/
Other
1.46k stars 777 forks source link

Renaming `/posts` makes elements disappear #316

Closed XPhyro closed 3 years ago

XPhyro commented 3 years ago

I can rename /posts to /articles like so:

[permalinks]
  posts = "/articles/:year/:month/:day/:filename"
[menu]
  [[menu.main]]
    identifier = "articles"
    name       = "Articles"
    url        = "/articles"

But, when I rename /posts to anything other than /post, the description, word count, reading time and date disappear from the post. Looking at the source of the theme, I see /posts and /post written a lot, so I suspect this is intentionally hardcoded.

My question is, how can I rename /posts to /articles and keep the aforementioned displays?

rhazdon commented 3 years ago

Hey @XPhyro, the thing is, that hugo (and this theme as well) expects that you uses the identifier "posts", because this points to the according html file. :)

Just rename the identifier to "posts" and name the rest like you want. It should work then. :)

XPhyro commented 3 years ago

It does indeed work. Thank you :)

nicolaipre commented 3 years ago

@rhazdon - I am running into a similar issue so I am commenting here.

How do you handle this when you have multiple sections? Currently, I only get the last loaded section when the identifier is the same.

[menu]
  [[menu.main]]
    weight     = 9
    identifier = "posts"
    name       = "Writeups"
    url        = "/writeups"
  [[menu.main]]
    identifier = "posts"
    name       = "Random"
    url        = "/posts"

Ideally I would like to have multiple sections and still show reading time, word count, etc.

slayer321 commented 3 years ago

Hey @rhazdon , I am also facing the same issue as @nicolaipre . Please help .

bigpick commented 1 year ago

FWIW; I found using:

[permalinks]
  post = "/post/:year/:month/:title/"

and

[menu]
  # ...
  [[menu.main]]
    identifier = "posts"
    name       = "Posts"
    url        = "post/"
    weight     = 10
  # ...

With my MD files in /content/post/ renders the URL in the generated site with the appropriate permalink.

i.e a content/posts/example/page.md with:

---
title: "Permalink Example"
date: 2022-11-18T00:00:01-00:00
---

renders to post/2022/11/permalink-example/