在 ExpressionEngine (1.6.x) 中自定义单条目模板
这要么非常烦人,要么非常尴尬。我已经设置了博客的大部分内容,但我不知道在哪里或如何设置单个条目模板,而不是包含它们的部分/博客。我只是找不到关于如何在我的一生中做到这一点的信息。
这一点尤其重要,因为我想为所有条目定义规范链接,因为 ExpressionEngine 以各种方式链接到条目。
因此,情况是我有一个博客部分/博客,其索引用作 mydomain.com
的首页。这列出了我的所有条目,就像您想象的普通博客一样。当我需要为单个条目的链接自定义代码时,问题就出现了。
This is either very annoying or very embarrassing. I've set up most of my blog, but I can't figure out where or how the heck I set up single entry templates as opposed to the section/weblog containing them. I just can't find information on how to do it for the life of me.
This is especially important, because I want to define the canonical link for all entries, since ExpressionEngine links to entries in all kinds of ways.
So, the case is that I have a Blog section/weblog with an index working as the front page for mydomain.com
. This lists all my entries as you would imagine a regular blog to do. The problem arises when I need to customize the code for the single entries' links.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您已经设置了一个显示多个条目的模板,并且您希望每个条目都有一个条目页面,那么您需要做的是:
然后在上面显示的模板中通过 template_group/template_name (请将它们更改为任何内容)您的模板组和模板名称实际上是;-))您将放置此代码:
然后,这将仅向您显示一个条目,因为您将在上面的第一个频道条目标签中使用 {url_title_path="template_group/template_name"}基本上会创建一个类似这样的URI:
http://www.example.com/template_group/template_name/ url_title_of_my_posted_entry
在第二个 (template_group/template_name) 单条目模板页面上,它将看到 URL 标题,并使用它来将频道条目标记过滤到仅该条目。
希望能有所帮助。
最好的祝愿,
If you have a template set up already which is showing a multitude of entries and you want a single entry page for each entry then what you need to do is this :
Then in the template shown above by template_group/template_name (please change those to whatever your template group and template names actually are ;-) ) you will place this code :
This will then show you just the one entry as you will have used the {url_title_path="template_group/template_name"} in the first channel entries tag above which would basically create a URI something like this :
http://www.example.com/template_group/template_name/url_title_of_my_posted_entry
On the second (template_group/template_name) single entry template page it will see the URL title and use this to filter down the channel entries tag to just that one entry.
Hope that helps a bit.
Best wishes,