Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Any headline (h1,h2, h3, etc) with a link inside, like the block headlines, are stripped from those links by the JavaScript preventing widows.
Example:
<h2><a href="node/1">A block headline</a></h2>
would be displayed as:
<h2>A block headline</h2>
A quick solution would be replacing
// Prevents Widows in Post Titles.
// @see http://css-tricks.com/preventing-widows-in-post-titles/
$(":header").each(function() {
var wordArray = $(this).text().split(" ");
if (wordArray.length > 2) {
wordArray[wordArray.length-2] += " " + wordArray[wordArray.length-1];
wordArray.pop();
$(this).html(wordArray.join(" "));
}
});
with:
// Prevents Widows in Post Titles.
// @see http://css-tricks.com/preventing-widows-in-post-titles/
$(":header:not(.header-processed)").addClass('header-processed').each(function() {
// Check if the headline has a link inside.
var obj;
if ($('a', this).length) {
obj = $('a', this);
}
else {
obj = $(this);
}
var wordArray = obj.text().split(" ");
if (wordArray.length > 2) {
wordArray[wordArray.length-2] += " " + wordArray.pop();
obj.html(wordArray.join(" "));
}
});
I am marking this major, since it breaks how the site navigation works. I'll update the dev release as soon as I can.
Thanks baptisten for pointing this out.
Comment | File | Size | Author |
---|---|---|---|
#1 | p6_base-widow_headlines_with_links-1789586-1.patch | 1.85 KB | osman |
Comments
Comment #1
osmanPatch is attached.
Comment #2
osmanComment #3
osmanCommitted the changes to 7.x-1.x-dev