如何从面包屑中删除 HOME
我正在使用 Drupal 6.17 并希望在面包屑输出中删除“HOME”...
例如:
$breadcrumb= PRODUCTS // SOFTWARE // FEATURES
而不是
HOME // PRODUCTS // SOFTWARE // FEATURES
I am using Drupal 6.17 and want to get rid of "HOME" in the breadcrumb output...
eg:
$breadcrumb= PRODUCTS // SOFTWARE // FEATURES
instead of
HOME // PRODUCTS // SOFTWARE // FEATURES
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这是 Drupal 7 版本:
Here's a Drupal 7 version:
覆盖主题 template.php 文件中的面包屑:
Override the breadcrumb in your theme's template.php file:
隐藏 Drupal 8 的“主页”面包屑
(将
yourtheme
替换为主题的实际机器名称...)选项 1:快速简单的主题预处理
将以下内容添加到主题的
yourtheme.theme
code> 文件:或选项 2:主题设置中的复选框选项
将以下内容添加到主题的
theme-settings.php
:将以下内容添加到主题的
yourtheme.theme
文件中:如果您希望在安装主题时默认禁用“主页”按钮,请将以下内容添加到主题的
yourtheme.settings 中。 yml
:如果您正在使用现有站点,并且正在使用 Drupal Configuration Syncing 与 Drupal 8,您还应该在同步目录中添加/修改
yourtheme.settings.yml
文件,然后运行drush cimsync
。或者选项 3:更细致的主题设置
在某些情况下,如果主页链接是面包屑路径中的唯一项目,并且还有其他项目,则网站设计可能会要求隐藏该链接在面包屑路径中离开面包屑路径中的Home。
< img src="https://i.sstatic.net/CCocc.png" alt="演示更细致的主题设置的屏幕截图,其中包含 3 个单选按钮选项来选择主页面包屑可见性选项">
以下是如何实现上面描述的单选按钮:
将以下内容添加到主题的
theme-settings.php
中:将以下内容添加到主题的
yourtheme.theme
文件中:如果您希望主页按钮安装主题时默认禁用,请将以下内容添加到主题的
yourtheme.settings.yml
中:如果您正在使用现有站点,并且正在使用与 Drupal 8 同步的 Drupal 配置,您应该还要添加/修改同步目录中的
yourtheme.settings.yml
文件,然后运行 drush cimsync
。Hide 'Home' Breadcrumb for Drupal 8
(Replace
yourtheme
with your theme's actual machine name...)Option 1: fast and simple theme preprocess
Add the following to your theme's
yourtheme.theme
file:Or Option 2: a checkbox option in theme settings
Add the following to your theme's
theme-settings.php
:Add the following to your theme's
yourtheme.theme
file:If you want the Home button to be disabled by default when the theme is installed, add the following to your theme's
yourtheme.settings.yml
:If you're working with an existing site, and are using Drupal Configuration Syncing with Drupal 8, you should also add/modify the
yourtheme.settings.yml
file in the sync directory, and rundrush cim sync
.Or Option 3: a more nuanced theme setting
In some cases, a site design might call for hiding the Home link if it is the only item in the breadcrumb trail, and when there are other items in the breadcrumb trail to leave Home in the breadcrumb trail.
Here's how to implement the radio buttons depicted above:
Add the following to your theme's
theme-settings.php
:Add the following to your theme's
yourtheme.theme
file:If you want the Home button to be disabled by default when the theme is installed, add the following to your theme's
yourtheme.settings.yml
:If you're working with an existing site, and are using Drupal Configuration Syncing with Drupal 8, you should also add/modify the
yourtheme.settings.yml
file in the sync directory, and rundrush cim sync
.主题面包屑输出 HTML
自定义面包屑
Theming Breadcrumb Output HTML
Custom Breadcrumbs
在 templated.php 中询问是否为“主页”并特定于语言。如果您不需要语言查找,请取出(&& $language_url->languag**e 和 **global $language_url;)。还将“href”中的“/htdocs/drupal/de”更改为适当的 URL。
In templated.php ask if "Home page" and be language specific. Take out ( && $language_url->languag**e and **global $language_url;) if you don't need language look up. Also change "/htdocs/drupal/de" in "href" to appropriate URL.
如果您安装了路径面包屑模块。转到结构>路径面包屑>路径面包屑设置,然后勾选“隐藏单个面包屑的面包屑导航”,保存配置,刷新页面。完毕。
If you have path breadcrumbs module installed. Go to structure > Path breadcrumbs > path breadcrumbs settings, then check the "Hide breadcrumbs navigation for single breadcrumb", save configuration, refresh page. Done.