I have view with 2 fields - created + title.
Title rendered as link with attribute alt=[title]
When I use alt=123 view renders field as <a href="/link/to/node" title="123">title</a>
If I use alt=[created] => <a href="/link/to/node" title="date created(correct)">title</a>
But when I set alt=[title] I get <a href="/link/to/node">title</a> without title attribute set.
Please help.

Comments

merlinofchaos’s picture

Priority: Critical » Major
Status: Active » Closed (works as designed)

That means [title] is empty. Make sure you have a title field with data.

merlinofchaos’s picture

Priority: Major » Normal
Status: Closed (works as designed) » Active

Hm. Rereading, maybe that's not the case.

Definitely not critical, though. No crash involved.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Can you please export your view? Perhaps the title field is defined after the other field.

andribas’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Thank you for reply.
I have read source code of view and found that:

/sites/all/modules/views/handlers/views_handler_field.inc
lines 592-595

    // Set the title attribute of the link only if it improves accessibility
    if ($alt && $alt != $text) {
      $options['attributes']['title'] = $alt;
    }

Unfortunately, this was not documented anywhere. In my case problem was solved by overriding value with "[title][blank]"

g089h515r806’s picture

Version: 6.x-2.11 » 7.x-3.x-dev
Category: bug » feature
Status: Closed (won't fix) » Active

I have the same problem. it is caused by following code:

// Set the title attribute of the link only if it improves accessibility    
if ($alt && $alt != $text) {      
  $options['attributes']['title'] = $alt;    
}

i think we need change it to :

if ($alt) {      
  $options['attributes']['title'] = $alt;    
}

Although it does not improve accessibility. It is usefull in SEO.

g089h515r806’s picture

Title: Views not create attribute title for <a> after set "Title text" to "[title]" using "Output this field as a link " » Views not create attribute title for <a>

I have a title field in views.
I use "Rewrite results" , "Output this field as a link " to improve SEO. My purpose is to add 'title' and 'target' attribute to 'a' tag.

Set "Link path" to "node/[nid]",
Set "Title text" to "[title]",
Set "Target " to "_blank",

Then 'target' attribute works, but 'title' attribute does not work.
After I set "Title text" to " [title]",
'title' attribute works.

I feel very confused that I have to change "[title]" to " [title]" to make it works.

g089h515r806’s picture

Title: Views not create attribute title for <a> » Views not create attribute title for <a> after set "Title text" to "[title]" using "Output this field as a link "
Category: feature » bug
Priority: Normal » Minor
chingis’s picture

Title: Views not create attribute title for <a> » Views not create attribute title for <a> after set "Title text" to "[title]" using "Output this field as a link "

I feel very confused that I have to change "[title]" to " [title]" to make it works.

I have the same behavior in views 6.x-3.0

caused by code in file views/handlers/views_handler_field.inc 992:5

    $alt = strtr($alter['alt'], $tokens);
    // Set the title attribute of the link only if it improves accessibility
    if ($alt && $alt != $text) {
      $options['attributes']['title'] = html_entity_decode($alt, ENT_QUOTES);
    }

I think this is good option, because it's pointless to display title if it's the same as link content
also, as I know, this doesn't affect SEO much

chingis’s picture

Status: Active » Closed (works as designed)
g089h515r806’s picture

Maybe it does not affect SEO for google and yahoo search.
But it seems that it is usefull for Baidu, the second largest search engine in global, the first largest search engine in China.

rteijeiro’s picture

Status: Closed (works as designed) » Needs work

Sorry for reopening this but tried with a "Global: custom text" field and "Rewrite results -> Output this field as a link". When I put something in "Title text" the title attribute is not displayed. I have to add a whitespace before the "Title text" in order to get title attribute displayed. I don't think this is "working as designed".

mvlabat’s picture

Priority: Minor » Normal
Issue summary: View changes

Having the same issue. It's awesome, how you'd found that a whitespace has to be added.
P.S. This bug is not minor, it's pretty normal.