PharaohOfParis
PharaohOfParis

Reputation: 304

HUGO URL: triggering the default single page of the layouts when I don't want to

My problem is simple from my point of view, but I'm struggling fixing it.

On my Hugo folder, if I resume the structure of my layouts and content folders, it's like this:

layouts
  |--- _default
    |--- baseof.html
    |--- list.html
    |--- single.html
  |--- blog
    |--- list.html
    |--- single.html

content
  |--- blog
    |--- posts

The code under /layouts/blog/list.html works fine -the design of the list page under the URL on local http://localhost:1313/blog/ is as I want it to be. However the code under /layouts/blog/single.html isn't working. Instead, I got the implementation of the code of the single page under /layouts/_default/single.html.

The source of this problem might be in the fact that I migrated my blog posts from WordPress with a plugin into Hugo. And the metadata of my blog posts are like this:

---
title: ...
author: ...
type: post
date: ...
url: /2020/10/title-of-the-post/
---

And the URL of my post on local is: http://localhost:1313/2020/10/title-of-the-post/.

What I did is obviously change the url in the metadata of the post to be like this:

---
url: /blog/2020/10/title-of-the-post/
---

Thus the URL of my post on local is now: http://localhost:1313/blog/2020/10/title-of-the-post/.

However, it didn't trigger the single page under /layouts/blog/single.html -the code implemented is still the one under /layouts/_default/single.html.

I don't have more idea to try. Has someone of you figured out how I could do it ?

Here are my permalinks configuration from the config.toml as I guess some of you might ask them:

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

Upvotes: 1

Views: 312

Answers (1)

PharaohOfParis
PharaohOfParis

Reputation: 304

I ended up finding the solution: it was to delete the line type: post in the front matter of my posts (or to change it to type: blog).

Upvotes: 2

Related Questions