Why is the 'post' layout missing from so many themes?

纵饮孤独 提交于 2019-12-04 18:33:41
marcanuy

Jekyll does not have a standard way of naming layouts, this has the benefit of flexibility but it can cause confusion sometimes.

Every theme can create their own layouts, so you will find that changing themes, doesn't work the way you expected, in fact, most don't because generally you will find default, page, and post layouts, but when you try another theme, their layouts would probably be called differently.

Take for example the minimal-mmistakes theme, one of the most popular themes out there, it has all these layouts:

_layouts/
  ├── archive.html
  ├── archive-taxonomy.html
  ├── categories.html
  ├── category.html
  ├── collection.html
  ├── compress.html
  ├── default.html
  ├── home.html
  ├── posts.html
  ├── search.html
  ├── single.html
  ├── splash.html
  ├── tag.html
  └── tags.html

if you just change your theme name in config, I bet it won't use all of those layouts.

This is why you need to customize your site following each theme requirements.

Note

You don't need to specify theme layout in each post, it is generally simpler to set it as a front matter default in config, and in this case, every post would use that:

defaults:
  -
    scope:
      path: ""
      type: "posts"
    values:
      layout: "post"

I don't´know which themes are you talking about, but you can find themes here:

http://jekyllthemes.org Most themes i look into have the post layout.

if you really need and can´t find it, you can create your own template for posts, by adding the post.html filo into the template folder, and simply call the default layout.

---
layout: default
---

perhaps you could add the link to the themes you are talking about and if they are on Github, you can always file an Issue on that theme.

here you call call a new Issue for Minima:

https://github.com/jekyll/minima/issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!