-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding rel=nofollow to all links #201
Comments
You could potentially wrap the built in href transformer with your own that will inject |
While I do understand the intention of getting more people to contribute with PRs, I am not sure if this is the best way to proceed. This is something that requires design and my ideas might be very far from acceptable to you. I would probably add global options that would be passed alongside state to all transformers, where each transformer could get at its options and use them. The href transformer would use :attributes, where one could specify |
There's actually some precedent for doing this already with I do think that the case could be addressed by making a custom transformer vector with the way things are currently set up. You would need a custom version of this vector where you replace the transformer for the tags with your custom version https://github.com/yogthos/markdown-clj/blob/master/src/cljc/markdown/transformers.cljc#L423 |
Thank you. I don't think I'm capable of designing this properly, so I've worked around the issue by copying large swaths of code from markdown.links (href, make-link and link), so that I could replace href with href-nofollow that adds the rel=nofollow attribute. |
No worries, glad to hear the immediate issue is solved. I'll leave this open as an enhancement, if I get a bit of time I'll look at implementing the feature. |
Just to chime in, I'd also like to modify links. Like, for example, adding target=_blank -- probably will fit in to your existing design? |
It sounds like the best approach here might be to allow passing around a map of options, such as attributes, that can be applied to each type of element. These could then be applied by the transformers. If anybody wants to try to adding this in, I can definitely help guide a pr, but I probably won't have time to look myself in the near future. |
Short of patching markdown-clj, is there a way to add
rel="nofollow"
to all links?This is pretty much a requirement for any user-supplied text that will be displayed on a public webpage, otherwise the SEO spamming crowd will eat you alive.
I've been looking at transformers, but it doesn't seem like they are created for that use case.
The text was updated successfully, but these errors were encountered: