Option to render URLs with rel="nofollow"
GoogleCodeExporter opened this issue · comments
The site I'm developing will suffer from questionable behaviour by people with
commercial interests if we let them post URLs without rel="nofollow" on all
HTML anchors generated in Markdown.
I've attached a patch (generated by Git) of the changes I made to Markdown.cs
in implementing support for this.
I haven't changed the default behaviour. Just set the NoFollowLinks property
to true if you want to opt into this behaviour.
Version number bumped too.
Original issue reported on code.google.com by drewnoakes
on 6 Oct 2010 at 11:27
Attachments:
we generally want to decide to nofollow based on a heuristic, e.g., is this
link inside our network at http://stackexchange.com/sites -- or outside it?
In my opinion, nofollowing links should be done as a separate pass. I guess I
could support "nofollow everything by default, then unfollow just the safe
links" but either way it is a loop across all the URLs in the input with some
custom logic that isn't really markdown specific.
Original comment by wump...@gmail.com
on 12 Nov 2010 at 8:52
Original comment by wump...@gmail.com
on 12 Nov 2010 at 9:02
- Added labels: Priority-Low
- Removed labels: Priority-Medium
Original comment by wump...@gmail.com
on 12 Nov 2010 at 9:03
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
Good point about deciding whether to include the attribute based on some
property of the link. In fact I think that's something I would like to do for
my app too, now you mention it.
However I'd still like to do this in a single pass, just to reduce the amount
of string churning on the server. I think it'd be simpler to code too. I'll
hook up a callback mechanism that passes out the URL to some optional external
code in order to decide whether to mark the link as nofollow or not.
Let me know if you're interested in a patch or not.
Original comment by drewnoakes
on 18 Nov 2010 at 2:53