Drupal 自定义内容类型建立父级和子级

发布于 2024-12-28 11:06:00 字数 580 浏览 5 评论 0原文

我目前正在 Drupal 上构建一个网站,我正在努力弄清楚如何拥有一些父内容(通过自定义内容类型创建)和一些通过不同自定义内容类型创建的子内容,这可能吗?

结果会是一些看起来像这样的输出?

  • 服务编号 1
    • 产品编号 1
    • 产品编号 2
    • 产品编号 3
  • 服务编号 2
    • 产品编号 4
    • 产品编号 5
  • 服务编号 3
  • 服务编号 4
  • 服务编号 5
    • 产品编号 6
    • 产品编号 7

从上面的列表示例中您可以看到,我想要创建一个嵌套列表来形成一些导航。我设置了一个名为“服务”的内容类型,还创建了一个名为“产品”的内容类型,但我看不到将产品链接到服务的方法。

我是否应该为此使用自定义内容类型?或者更好的方法是使用分类法?如果是这种情况,我如何才能创建指向产品或服务页面的分类链接,而不是它自己的分类页面?

我觉得我完全是在胡说八道,本质上我无法找到一种简单的方法来在 Drupal 中创建嵌套导航。

I am currently building a site on Drupal and I am struggling to work out how to have some parent content (that is created through a custom content type) and some child content that is created through a different custom content type, is this even possibe?

The outcome would be to have some output that would look like this?

  • Service Number 1
    • Product Number 1
    • Product Number 2
    • Product Number 3
  • Service Number 2
    • Product Number 4
    • Product Number 5
  • Service Number 3
  • Service Number 4
  • Service Number 5
    • Product Number 6
    • Product Number 7

From the list example above you can see that I am wanting to create a nested list that will form some navigation. I have a content type called "Services" set up and a content type called "poducts" also created, but I see no way of linking products to services.

Should I even be using custom content types for this? Or would better way to do be go down the route of using taxonomies? If that were the case how can I make a taxonomy link to a product or service page, and not it's own taxonomy page?

I feel like I talk complete nonsense, essestially I cannot work out an uncomplicated way to create a nested navigation in Drupal.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

琴流音 2025-01-04 11:06:00

我们一直收到对这样结构的网站的请求。这些模块的组合总是对我有用:

We get requests for sites structured like this all the time. A combination of these modules always does the trick for me:

半山落雨半山空 2025-01-04 11:06:00

您可以使用 Entity Reference 模块来实现此目的。

创建两个内容类型:“服务”和“产品”,并在产品(子)内容类型中添加引用服务节点(父)的强制“实体引用”字段。

You can use Entity Reference module for this.

Create the two content types: 'Services' and 'Products' and in Products (child) content type, add a mandatory "Entity Reference" field that references to a Services' node (parent).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文