[英]Restrict block visibility by page and content type in Drupal 8
I declared a block to display the 3 most recent articles published and I would like to display it on a specific page so I added /my-page/
into the block page list but it didn't worked. 我声明了一个阻止区域,以显示最近发表的3篇文章,并且希望将其显示在特定页面上,因此我在阻止页面列表中添加了/my-page/
,但是没有用。 I then changed it to /my-page*
and it worked but I ended up getting my block on /my-page/other-content
which is not what I wanted. 然后,我将其更改为/my-page*
并且可以正常工作,但最终我将块放在/my-page/other-content
,这不是我想要的。
Moreover if I declare a list of page and a content type, my content type is not taken into account. 此外,如果我声明页面列表和内容类型,则不会考虑我的内容类型。
Am I doing something wrong ? 难道我做错了什么 ?
Could you first of all simply try /my-page
without the trailing slash, please. 您能否首先尝试不带斜杠的/my-page
。
Apart from that you may have a look a the following module: 除此之外,您还可以查看以下模块:
Then you'd say Show for the listed pages
然后,您Show for the listed pages
说出Show for the listed pages
/my-page*
!/my-page/*
And regarding the content types there was a bug with ctools which still seems to be unfixed. 关于内容类型,还有一个ctools的错误,该错误似乎仍未修复。 So you may have a look at: 因此,您可以看看:
Block Visibility Groups 阻止可见性组
Here you can configure a visibility group which hides blocks for a specific content type. 在这里,您可以配置可见性组,以隐藏特定内容类型的块。
The visibility groups also are reusable, that means you can apply the same settings on multiple blocks. 可见性组也可重用,这意味着您可以在多个块上应用相同的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.