How to serve blogposts taxonomy from root directory instead of /posts

I’m listing my blog entries on my home page. I’d like to have appear on my site as, not ( I want to essentially replace the homepage with /posts then eliminate /posts). I’ve been able to list my content on the homepage with some changes in layouts/partials and by placing all my blog markdown directly into content/.

While the blog entries render and are served, they don’t show tag, date information anymore (and I assume Giscus will also not work when I add it). Does anyone know how I can fix this?

Add a permalinks setting in your site configuration:

I think we would need to the project repository.

1 Like

Thanks, I tried adding this to my config.toml by adding

posts = '/'

I didn’t notice an effect but I’m guessing that’s because I already modified the partials to display list.html instead of home.html, so I my list of articles there to begin with.

I think we would need to the project repository.

Not sure if I understood you; are you saying this (serving taxonomy information on blog posts from the root folder) isn’t currently supported by Hugo?

I just edited your post, surrounding code/config with three backticks. Does this now match your site config?

That was confusing, sorry. Yes, that’s exactly how it is.

Use markdown when posting here, just like you were writing a post for a Hugo site.

You need to do this, like the examples in the documentation:

posts = '/:slug/'

No. What I am saying is that it is difficult to answer your question without seeing your site structure, templates, etc.


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.

Sounds good and thanks: GitHub - ryanwwest/website at v4. (use branch v4 and the themes/rytheme directory is now irrelevant). I appreciate your help.

I’m not sure if the themes/hugo-coder directory will show up properly there since it’s a submodule. If not, it is at GitHub - ryanwwest/hugo-coder: A minimalist blog theme for hugo..

1) The content directory does not contain a posts directory. So I’m not sure what you want.

2) You should consider creating a .gitignore file for:

  • public/
  • node_modules/

3) In your site configuration:

  • The baseURL should be that of your live site (e.g., Note the trailing slash.
  • There is rarely a good reason to set relativeurls = true
  • Replace the pygments settings with the relevant settings from the documentation, though the defaults are fine in most cases. We haven’t used pygments in many years.
1 Like

The content directory does not contain a posts directory

Thanks, this was my problem. I removed it in an earlier effort to get posts to be displayed, but without the permalink it wasn’t the right way to go. Now it is working.

And thanks for the other helpful advice, I’ll work on implementing it. With regards to baseURL, the reason I use it is to develop locally and on a remote private server I own via Tailscale (and also host the site on my public hosting box), and have the site work on all three - when I’ve put my full site name there, it begins loading remote content from the public version of my site on my local instance.

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