<?php if ($logo): ?>
      <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
        <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
      </a>
    <?php endif; ?>

This is a logo represent your website, brand..etc. When it can't show normally, it should tell us this is a LOGO of this website (Your website name or slogan). Logo is not the HOME, the wrapper LINK is link to homepage that is HOME.

The alt attribute specifies alternate text that is rendered when the image cannot be displayed
http://www.w3.org/TR/REC-html40/struct/objects.html#edef-IMG

CommentFileSizeAuthor
#19 bartik_logo_alt-2.patch620 bytesmgifford
bartik_logo_alt.patch553 bytesdroplet
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, bartik_logo_alt.patch, failed testing.

droplet’s picture

Missed there hasn't $site_name_and_slogan on bartik. Seeks for feedback first, I will patch it again later.

oriol_e9g’s picture

why not?

<img src="<?php print $logo; ?>" alt="<?php print $site_name . ' - ' . $site_slogan; ?>" />

or

<img src="<?php print $logo; ?>" alt="<?php print $site_name; ?>" />
Everett Zufelt’s picture

Title: Logo's ALT should not be "HOME" » Decide on appropriate alt text for default logo
Component: Bartik theme » markup
Category: task » bug
Issue tags: -Needs backport to D7 +Accessibility

See: #717708: Document how to set logo in theme with proper alt tags for ability to set custom alt on logo.

This is a string change and I am not in support of backporting to 7.x

The purpose of the alt attribute on an image is to provide an alternative textual replacement for an image, for when the image is not available. It becomes more tricky to provide an appropriate alt when the image is also a link, as most AT will only read the alt, and not the alt + link title. I am pretty comfortable with leaving this as 'Home', but am open to suggestions of other strings.

I think that site-name site-slogan is a bit verbose, and doesn't cover the purpose of the link, to take the user to the 'Home' page of the site.

droplet’s picture

What's the main purpose of this? ("LOGO & LINK")

Show a "website logo" or a "back home" link ??

I think websites Logo never tell users: BACK TO HOME (Visitors only know it's a logo of the website, no one use an image with "HOME" text to be site logo). Disabled images. It's same.

Whatever you hover the link, it will tell you this is a "Home Link" (A tag's title)

It's also a SEO problem.

dcmouyard’s picture

I personally use a blank alt attribute for the logo in my themes, but I don't use the logo as a link. In fact, I don't even display the logo unless someone prints the page.

Since Drupal core and most themes use the logo as a link to the home page, I think the alt attribute should describe where the link is pointing to. Anything along the lines of 'Home,' 'Home page,' or 'Back to home' sound reasonable to me.

jherencia’s picture

droplet’s picture

Your logo is "Drupal", a link point to "Drupal", it's alright. Always better than "back home" on LOGO, less side effect.

Remove link on Logo isn't a good practice.

Everett Zufelt’s picture

I posted a message to the WebAIM discussion list, let's see if we get any useful feedback.

http://webaim.org/discussion/mail_message?id=18547

dcmouyard’s picture

Why is removing the link around the logo not good practice if the logo is never displayed, except for printing purposes?

droplet’s picture

Generally, websites have link around the Logo and it will link back to home. Users assumed it on all websites. Have you ever think about where the LOGO is linking to.. ?

<h1 id="site-name">
  <a rel="home" title="Home" href="/"><span>Drupal Website</span></a>
</h1>

It's code on default Bartik theme too. It still link back to your website home but never use "back to HOME". I think no one disagreed this one. Why you don't disagree it ??

in Drupal case, all default theme & installation have a HOME link (text is HOME). No Home text on Logo & Title don't means you will lost the way. But now, you DON't KNOW that image is the website logo.

mgifford’s picture

Mostly subscribing & hoping to help simplify this piece of D8.

dcmouyard’s picture

@droplet - Just to clarify, I completely agree that the logo, if displayed on the screen, should link to the home page. In my themes, however, I only display the logo when a user prints the page.

As far as the alt attribute text goes, it seems like using either some form of 'Home' or the site's name is acceptable, since they both describe where the link is pointing to. Because there seems to be a SEO benefit to using the site's name, that's my vote.

droplet’s picture

Issue tags: +SEO

@dcmouyard,
You can use a media-specific stylesheet for print. :)

Sounds like replies from #9 mail list are support to use Site name as LOGO alt.

Our W3C WAI:

<div id="masthead">
<p id="logos">
<a href="http://www.w3.org/" title="W3C Home"><img alt="W3C logo" src="/Icons/w3c_home"></a>
<a href="http://www.w3.org/WAI/" title="WAI Home"><img alt="Web Accessibility initiative" src="/WAI/images/wai-temp"></a></p>
</div>

WebAIM:

<a href="/" class="transparent">
<img src="/media/template/logo.gif" alt="WebAIM - Web Accessibility in Mind" width="189" height="86">
</a>
Everett Zufelt’s picture

Okay, let's go with $site_name. I'll roll a patch.

oriol_e9g’s picture

Issue tags: +Novice
Everett Zufelt’s picture

Status: Needs work » Postponed
andrewmacpherson’s picture

mgifford’s picture

FileSize
620 bytes

Noting that Bartik is the only theme at the moment that has this issue. Not sure what the next core theme will be, but...

Figured I'd update the patch here. Hopefully we get a resolution about the custom logo issue above.

BarisW’s picture

I'm not sure if we can only print the $site_name_and_slogan. In the WAI and W3C cases, the logo reads the site name, so then it makes sense to just let it be the site name. But when a logo doesn't contain text , it should say something like 'Logo of Site Name'.

For example, see whitehouse.gov:

<img src="/sites/default/themes/whitehouse/img/clear.gif" alt="The White House Emblem" title="" width="1" height="1">

Our company is focussed on accessibility; for our sites we always tend to do this:
<a href="/" title="Back to the homepage"><img src="logo.png" width="200" height="100" alt="Logo of Site Name" title="Site Name - Site Slogan" /></a>

The ALT tag should describe the image, the title can give more info like the slogan, right?

mgifford’s picture

Status: Postponed » Closed (duplicate)

This patch has been bundled up into #717708: Document how to set logo in theme with proper alt tags with the following code for bartik:

      <a href="<?php print $front_page; ?>" title="<?php print $logo_alt_text; ?>" rel="home" id="logo">
        <img src="<?php print $logo; ?>" alt="<?php print $logo_alt_text; ?>" />
       </a>

Your proposing that it be something like this by default:

      <a href="<?php print $front_page; ?>" title="<?php print t('Back to the homepage'); ?>" rel="home" id="logo">
        <img src="<?php print $logo; ?>" alt="<?php print $logo_alt_text; ?>" title="<?php print $site_name . ' - ' . $site_slogan; ?>" />
       </a>

I don't know if any AT will see the title on the image under the title on the link. Titles haven't been well used on images in the past, so we've generally defaulted to simply using alt for images and title for text (if we want the tooltip on hover).

Anyways, this should probably be moved over to the other issue. Just wanted to clarify this here.