Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The Read More link for a teaser has the same text for every teaser. WAI AA requires a unique title if the text is not unique but the title just repeats Read More as the verbose "Read the rest of this posting.". Make the title unique by appending the title.
In node.module, change node_link from:
'attributes' => array('title' => t('Read the rest of this posting.'))
to:
'attributes' => array('title' => t('Read the rest of ' . $node->title))
Comment | File | Size | Author |
---|---|---|---|
#4 | drupal-read-more-description-174933.patch | 726 bytes | Freso |
#2 | drupal-read-more-description-174933-2.patch | 716 bytes | webchick |
Comments
Comment #1
StevenPatzComment #2
webchickThis sounds more like a bug than a feature request, and therefore can be fixed in 6.x (and possibly back-ported to 5.x).
The suggested fix is a bit dangerous though; node title could contain anything, so it needs to be check_plain()ed.
So this one adds the node title as placeholder in the string.
Comment #3
Freso CreditAttribution: Freso commentedUsing my fresh D6 CVS install, I generated a bunch of (= 100) nodes with Devel Generate and went and checked the text, which said
I then tried to apply the patch, which went cleanly, refreshed the page and now properly got . However, trying with the title , I get this:
title="Read the rest of !"#€%&/()=?`><."
- notice the doubly escaped ampersands! (The code for the<h2>
title itself istitle="!"#€%&/()=?`><"
- no doubly escaped ampersands.)Comment #4
Freso CreditAttribution: Freso commentedI've tried digging into the API and the code, and for all I can tell,
node_link()
inherits a call tol()
fromhook_link()
, which runs the text (including attributes) throughcheck_plain()
. Which means that using@
is superfluous, and using!
should do fine. But I am must admit that I haven't been able to locate any actual references in any functions or anything, but, well, yes.I've attached a patch with
!
instead of@
, please review and see if there's anywhere this isn't escaped.Comment #5
webchickAh-ha, I had forgotten about the check_plain() in l(). Thanks, Freso!
Looks like this is good to go.
Comment #6
Gábor HojtsyThanks. I also added a comment that the title gets escaped later, so people will not fix this "bug".
Comment #7
peterx CreditAttribution: peterx commentedThe line
'attributes' => array('title' => t('Read the rest of !title.', array('!title' => $node->title)))
works in Drupal 5.2 and is in use on http://petermoulding.com.
Thank you for fixing the last WAI issue for Drupal and the modules in use on my site.
Comment #8
(not verified) CreditAttribution: commented