Opened 3 years ago

Closed 16 months ago

Last modified 12 months ago

#4950 closed enhancement (fixed)

Links in Trac tickets should be nofollow'd

Reported by: jonoaldersonwp's profile jonoaldersonwp Owned by: dd32's profile dd32
Milestone: Priority: lowest
Component: Trac Keywords: seo


Links in trac tickets should have a rel="nofollow" attribute, in order to reduce the attraction of the platform as a target for spammers.

Change History (9)

#1 @dd32
3 years ago

  • Keywords close added

Unfortunately Trac doesn't allow an easy way to do this. was closed as wontfix

The only way to achieve this is to write a Trac plugin, as comment content can't be altered within a Trac template.

#2 @jonoaldersonwp
3 years ago

  • Keywords close removed
  • Type changed from defect to enhancement

Can we write a Trac plugin?
Their legacy bad decisions shouldn't result in us leaving holes in our defences :)

#3 @dd32
3 years ago

We can, but we're not writing/deploying new plugins due to the lack of people to maintain them ongoing.

#4 @dd32
16 months ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 11548:

Trac: Mark links in ticket descriptions/comments as rel="ugc nofollow".

Fixes #4950.

#5 @dd32
16 months ago

Well, that definitely worked.

$ curl -s | grep 'ext-link'

<a class="ext-link" rel="ugc nofollow" href=""><span class="icon"></span></a> was closed as wontfix<br />

#6 @dd32
16 months ago

Oh, also, just noting that you can't do a py:match against a.ext-link, as it seems that it can only match on elements that exist within the templates, not against the dynamic content inserted within those template tags.. although you can filter the template stream within the template tags as shown in the commit above.

#7 @dd32
16 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#8 @dd32
16 months ago

In 11565:

Trac: Revert [11548] to see if it's caused #6112.

See #6112, #4950.

#9 @dd32
16 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 11583:

Trac: Mark links in ticket descriptions/comments as rel="ugc nofollow". Take two.

[11548] was previously applying to all 'searchable' elements which includes the code browser.
The code browser uses a different String class, and being treated as a Markup string caused it to strip content that was unexpected within it.
This implements [11548] again verifying the specific string classes which we can alter, and narrowing it further by only applying to the ticket/comment classes and only when ext-link is present, to reduce potential breakage.

Fixes #4950.

Note: See TracTickets for help on using tickets.