Score:-2

How can I replace the Home link with an image?

ru flag

I want to replace the Home link shown in breadcrumbs with an icon.

screenshot

screenshot

How can I achieve this?

ru flag
Not an answer, but actually CSS is a very good solution for accessability reasons: A blind person with a screen reader should still get the text "Home" (e.g. with `class="visually-hidden"`) instead of the icon.
apaderno avatar
us flag
Even with JavaScript and CSS, there is still the need to change the markup used for the breadcrumb. Answers could describe how the breadcrumb markup can be altered.
Score:0
br flag

I’m not in the theme business but I suppose you can just override the twig template.

Assuming that the default template is in use:

[your_site]/core/themes/bartik/templates/classy/navigation/breadcrumb.html.twig

Just copy it to your theme templates folder and change it something like:

{#
/**
 * @file
 * Theme override for a breadcrumb trail.
 *
 * Available variables:
 * - breadcrumb: Breadcrumb trail items.
 */
#}
{% if breadcrumb %}
  <nav class="breadcrumb" role="navigation" aria-labelledby="system-breadcrumb">
    <h2 id="system-breadcrumb" class="visually-hidden">{{ 'Breadcrumb'|t }}</h2>
    <ol>
  {% for item in breadcrumb %}
      <li>
      {% if item.url %}
        {% if item.text == "Home" %}
          <a href="{{ item.url }}">
            <img src="some_src" alt="Some alt">
          </a>
        {% else %}
          <a href="{{ item.url }}">{{ item.text }}</a>
        {% endif %}
      {% else %}
          {{ item.text }}
      {% endif %}
      </li>
  {% endfor %}
    </ol>
  </nav>
{% endif %}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.