Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-05-23 11:01:00

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Automaic title attributes in Txp link URLs

I think I opened a can of worms by creating an outbound links policy that promises to use title="External link" in all outbound links, but I have. (I suppose it’s not too late to backpedal on that, if anyone has good humanitarian or technical arguments for doing so, but for the moment let’s humour the captain-editor.)

The problem, I’m just realizing, is when creating Txp link lists. If I don’t add that attribute to these links, I’m shown to be a liar against the policy. Is there a not-to-rediculously-labour-intensive way to accomplish adding those attributes automatically?

Offline

#2 2019-05-23 11:13:46

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Automaic title attributes in Txp link URLs

Hi Destry,

External links should be marked so in their rel attribute. Once you have that, you can create a pseudo element via css.

This is how we approached it on the NeMe site. And you can see it in action in the notes at the bottom of this page.

ps. The problem with hover, is that it does not work on mobile devices.

Last edited by colak (2019-05-23 11:15:41)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2019-05-23 11:46:47

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Automaic title attributes in Txp link URLs

Thank you. I’m solving two problems, then. ;)

Offline

#4 2019-05-23 12:09:31

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Automaic title attributes in Txp link URLs

Re external links in my sites, I have also created a simple short tag which I named ext

<a rel="external" href="<txp:yield name="url" />"><txp:if_yield name="txt"><txp:yield name="txt" /><txp:else /><txp:name="url" /></txp:if_yield></a>

which I call in the articles by using <txp::ext url="http://..." txt="linked text" />

Admittedly, it is not hard to actually add the html including the rel attribute, but the snippet saves some typing and reduces the possibility of errors.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2019-06-06 13:28:46

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Automaic title attributes in Txp link URLs

colak wrote #318179:

Re external links in my sites, I have also created a simple short tag which I named ext

Following up with this… I realize now that if I really want to be the good web monk and use rel="external", I need to do that in all my inline links too. Ugh.

So, just so I understand, you’re short-tag could be used inline like this, for example, where an external link might go?

A <txp::ext url="path" /> in a paragraph.

That’s not terrible, but I wonder how many karma credits I lose if I just stick with Txp links without the rel

Ideally, there would be a way to add the rel attribute via Txp somehow for only those links that needed them, like "[rel]this":url. Five extra characters is better than 15, or whatever.

I think straight brackets can be used like this already: %[fr]Française !%

Offline

#6 2019-06-06 14:06:38

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Automaic title attributes in Txp link URLs

Destry wrote #318389:

Ideally, there would be a way to add the rel attribute via Txp somehow for only those links that needed them, like "[rel]this":url. Five extra characters is better than 15, or whatever.

You can, of course, use plain HTML anchors inline in Textile like so:

This is <a rel="external" href="https://facebook.com">a great company</a>.

Granted, it’s not as shorthand as Colak’s shortcode but hey. For links that use the Textpattern link tag specifically you can use <txp:link rel="external" ... />.

Offline

#7 2019-06-06 14:11:50

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: Automaic title attributes in Txp link URLs

Yeah.

Just seems that it’s something in the spirit of what Textile was created to do; get as much markup out of the way as possible.

But, what is the loss of not using rel="external" to begin with? Accessibility? If not that, then I don’t think I care about it.

Offline

#8 2019-06-06 15:02:59

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: Automaic title attributes in Txp link URLs

Destry wrote #318393:

But, what is the loss of not using rel="external" to begin with? Accessibility? If not that, then I don’t think I care about it.

Twofold, one for accessibility to tell screen reader users that the linked file leaves the current domain. The other is to explicitly tell search engine spiders that the linked file is an external one and not to be indexed within the context of this site (although the spider probably already knows that because of the different domain).

Offline

Board footer

Powered by FluxBB