Post footer not showing for articles in root content folder

I want to have my posts to show up as https://blog.peoray.com/hello-world instead of something like https://blog.peoray.com/a_folder_name/hello-world.

I remove the containing folders (Home, Tutorials, Personal) and also main.menu and also copied and pasted the articles I already have into the root content folder but viewing it on the browser, I noticed that the post-footer isn’t showing (newsletter, tags, social media sharing and disqus)

How do I o about this and fixed it, I hardly know any Go to fix this

Link to repo

No need to move your content folders (as this will probably break other things too).

What you want is to set permalinks for your sections: https://gohugo.io/content-management/urls/#permalinks

1 Like

Also ghostwriter theme has three templates for pages, depending on the type of the page:

  • Default (with disqus) (layouts/_default/single.html)
  • Page (without disqus) (layouts/page/single.html)
  • Post (with disqus) (layouts/post/single.html)

If you move your content files in subfolders, the template that applies might change as per Hugo layout lookup order, depending on the type your content gets. If it’s not “post” anymore, the “post” template is not applied.

Hello, thanks for taking time to answer. I think from your explanation, it’s in the page template that applies. I don’t know Go, so please bear with me.

Does this mean I have to create a template for each of them. I’m usin main.menu params in the config.toml file which where the navigation comes from and from what I read, to apply it, you need to create the folder and put each article in the catgory you want.

Also, what I just need is to maintain my directories I have for each article so I know where each articles are but I don’t need the navigation and I want my link to be example.com/hello-world (where hello-world is the filename)

UPDATE: Indeed, its Page (without disqus) (layouts/page/single.html) that renders when I place the article in the root content folder, I just copy Default single.html into Page single.html and it works fine.

I guess the main issue now is how to maintain the same folder I have but my url should be example.com/hello-world` (where hello-world is the filename)

Hello, thanks for taking time to answer. I don’t know Go, so please bear with me.

My permalinks somehow does not affect the url, this is what I have:

[Permalinks]
    post = "/:year/:month/:day/:filename/"

but that doesn’t get applied as the url show something like example.com/<folder_name/<filee_name>

I also have a menu.main in my config.toml but I notice what that does is to create a naviagtion for me, it doesn’t affect the url, so if I delete, then I wont see any navigation on the page.

Do you have a section named post? If not then replace that with an actual section name

Again, apologizing for my noobness, but what do you mean by section in this case?

Any folder in your root content dir basically. For example you mentioned home, tutorials, and personal. Those are likely all sections, and each can have their own permalink

1 Like