admin管理员组文章数量:1292175
I want to take some posts of a similar type, split them into named building blocks, store those separately, and finally put them together in a consistent nature using templates while rendering.
For example, I want my technical posts to resemble the structure of how I normally ask questions on the StackExchange sites, for example:
- What is the problem?
- What was my research?
- The solution I found
- Sources and further reading
Normally I would write out a post into a single uniform body, and just split it with h1's. Problem is, if I later decided to
- replace h1's with h2's, or
- make each of those headers have a permalinkable #anchor, or
- make the research block collapsed by default because most Googlers want just the answer anyway, or
- mark them up as structured data, or in any other way I am not yet aware of,
I would have to edit all posts – which would be a lot of ineffective, error prone manual work. Instead, I would prefer to simply edit one reusable template.
I am therefore looking for a way to separate content from the templates, while enforcing a rigid post structure. This resembles how the interfaces are being used in programming: if a given class implements some interface, this is a guarantee that it will have all methods defined in that interface, otherwise the compiler throws an error and won't let the program continue. Or in my case, if a post implements the e.g. "Q&A" type, this should be a guarantee it has all of the above sections.
Here's what I found:
- Custom fields won't work because apparently they're plain text
- Post formats won't work either because they do not enforce any post structure and are merely an indicator for the theme on how to render the post
本文标签: Enforcing a rigid reusable template structure for similar posts
版权声明:本文标题:Enforcing a rigid reusable template structure for similar posts? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741549216a2384776.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论