简体   繁体   English

Drupal 8:如何根据标签生成分类页面

[英]Drupal 8: How to generate a taxonomy page based on tags

In Drupal 8, I have a blog posts assigned to different categories.在 Drupal 8 中,我有一个分配给不同类别的博客文章。 Each category has its page: ie /blog/sports.每个类别都有其页面:即/blog/sports。 Along the category, each post can be assigned to a tag or multiple tags: ie basketball, football, baseball.沿着类别,每个帖子都可以分配到一个标签或多个标签:即篮球、足球、棒球。 When content moderator adds a new post tag which didn't exist before, I need to generate a category page containing posts with that tag: ie /blog/basketball.当内容版主添加一个以前不存在的新帖子标签时,我需要生成一个包含带有该标签的帖子的类别页面:即/blog/basketball。 Is this something that Drupal 8 does out of the box, or do I need to build a custom feature using the preprocessor?这是 Drupal 8 开箱即用的功能,还是我需要使用预处理器构建自定义功能?

I would comment but this account is low on rep, yes you can do that out of the box with Drupal 8. Here's some steps to help:我会发表评论,但此帐户的代表人数很少,是的,您可以使用 Drupal 8 开箱即用地做到这一点。以下是一些帮助步骤:

  1. Got to Structure->Views转到结构-> 视图
  2. Select name for your view eg sport-blogs Select 您的视图名称,例如运动博客
  3. Under displays, next to Mater click the add button and select "Page"在显示下,在 Mater 旁边单击添加按钮和 select “页面”
  4. Under page settings to the right, enter the url path you want for your new page on.在右侧的页面设置下,输入新页面所需的 url 路径。 It doesn't need to be absolute.它不需要是绝对的。
  5. Select Add under Filter criteria Select 在过滤条件下添加在此处输入图像描述

6. On the filter criteria select "taxonomy term" under Category 7. Select the name of your vocabulary of terms 8. Finally select all terms that you want shown or select only one eg basketbal 6. On the filter criteria select "taxonomy term" under Category 7. Select the name of your vocabulary of terms 8. Finally select all terms that you want shown or select only one eg basketbal

Assuming all was set correct at this point you may be able to see a live preview based on your filters and existing content at the bottom of the view page.假设此时所有设置都正确,您可能会根据您的过滤器和视图页面底部的现有内容看到实时预览。 Once saved the view will be accessible to the path you've entered.保存后,您输入的路径将可以访问视图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM