【问题标题】:Remove Welcome to in Drupal 8在 Drupal 8 中删除 Welcome to
【发布时间】:2015-11-25 21:31:33
【问题描述】:

如何从 Drupal 8 的首页标题中删除“欢迎来到”

在 drupal 7 中,您只需在 page.tpl.php 中添加这部分代码:

<?php if (!$is_front){
print render($page['content']);
} ?>

【问题讨论】:

    标签: drupal drupal-8


    【解决方案1】:

    在 D8 的首页是一个视图。要更改首页的标题,请转到 admin/structure/views/view/frontpage,找到 Global: Title override 链接

    打开它,它将允许设置或删除自定义首页标题。

    【讨论】:

    • 是否可以翻译此文本?
    • 对我来说,当移除 Title override 设置时,Home 一词会出现在站点名称之前。前任。 “首页 | 泰菲博士”。如果您只想使用站点名称作为首页磁贴,您可以修改主题的 html.html.twig 并使用 &lt;title&gt;{% if not root_path %}{{ head_title.name }}{% else %}{{ head_title|safe_join(' | ') }}{% endif %}&lt;/title&gt; 作为标题标签。
    【解决方案2】:

    带有 url /node 的默认视图我们保持原样。

    在 page.html.twig 中我们输出除了内容块之外的所有块:

    {% if is_front %}
      {{ page.content.breadcrumbs }}
      {{ page.content.page_title }}
      {{ page.content.local_tasks }}
      {{ page.content.help }}
      {{ page.content.local_actions }}
      {#{{ page.content.content }}#} < no content
    {% else %}
      {{ page.content }}
    {% endif %}
    

    page-title.html.twig

    {% if title %}
        {# nothing #}
    {% else %}  {# for other pages #}
        <h1{{ title_attributes.addClass('page-header') }}>{{ title }}</h1>
    {% endif %}
    

    【讨论】:

      猜你喜欢
      • 2018-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-04
      • 1970-01-01
      • 2020-04-05
      • 2023-04-07
      • 1970-01-01
      相关资源
      最近更新 更多