螺栓中的内容类型

2024-06-22

我试图在 Bolt 中为两种内容类型提供相同的单一 slug。它们都应该具有相同的字段和相同的模板。此时我使用record_template:标签来设置每个内容类型的默认模板。

vervolgpagina:
  name: vervolgpagina
  singular_slug: graszoden
  singular_name: vervolg
  fields:
      titel:
          type: text
          class: large
          group: Content
      slug:
          type: slug
          uses: titel
          group: Content
      body:
          type: html
          height: 500px
          group: Content
      meta_keywords:
          type: text
          group: SEO
          label: "Meta keywords"
      meta_description:
          type: textarea
          height: 50px
          group: SEO
          label: "Meta description"
  record_template: vervolgpagina.twig

graszoden:
  name: graszoden
  singular_slug: graszoden
  singular_name: gras
  fields:
      titel:
          type: text
          class: large
          group: Content
      slug:
          type: slug
          uses: titel
          group: Content
      body:
          type: html
          height: 500px
          group: Content
      meta_keywords:
          type: text
          group: SEO
          label: "Meta keywords"
      meta_description:
          type: textarea
          height: 50px
          group: SEO
          label: "Meta description"
  record_template: vervolgpagina.twig

因此,如果我只是放入两种内容类型之一并向其中添加一个页面,那么它 将我重定向到/graszoden/vervolgpagina

所以如果我添加第二个内容类型并向其中添加另一个页面/graszoden/randomexample

现在发生了什么。那个页面运行得很好。说 ERROR 404,另一页给我一个螺栓错误,提示“未指定 Listing.twig 文件”。

有没有办法在 cms 中以其他名称显示内容类型两次?或者有没有办法为两种内容类型提供相同的单数 slug?

提前感谢,


不,你不能。如果您有两种具有相同 slug 和相同字段的内容类型,那么它实际上应该只是一个 CT。

也许您可能想要的是“分组分类法”,请参阅taxonomy.yml 中的示例。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

螺栓中的内容类型 的相关文章

随机推荐