I have read through the docs and I’m pretty sure I am putting my single.html file in the correct place for a section.
I have the following:
/content/blog/a-blog-post.md
I have created a custom theme.
/themes/MYTHEME/layouts/blog/single.html
But all of the blog posts are using the single.html layout from my theme’s _default directory.
What and how can I troubleshoot the problems? I tried moving the custom single.html file to all of the other places and nothing works.
I have Permalinks set? Does that affect the layouts at all?
@greathouse hi, can you paste your post’s frontmatter? Some settings in there can override what’s getting loaded.
The path /themes/MYTHEME/layouts/blog.single.html
looks correct to me according to the docs. Personally, I’m chucking everything in /layouts/_default
.
One trick to help see what template or partial is getting rendered is, to put html comments on the first and last lines.
An example:
I have those ENTERING / LEAVING statements in my templates and partials so that I can see what’s getting rendered, by doing view source.
Try:
1: putting the single layout in: themes/YOURTHEME/layouts/blog/single.html
2: the list layout in themes/YOURTHEME/layouts/section/blog.html
3: change type = "post"
to type = "blog"
in the frontmatter.
I think that should fix things as regards using the correct template. However, if you’ve written any other custom code elsewhere which depends on looking for type = "post"
in the frontmatter, that might need adjusted too.