Skip to content
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

Nofollow links #93

Open
xPaw opened this issue Apr 28, 2013 · 9 comments
Open

Nofollow links #93

xPaw opened this issue Apr 28, 2013 · 9 comments

Comments

@xPaw
Copy link

xPaw commented Apr 28, 2013

Would be nice to have an option to make all links rel="nofollow".

@funivan
Copy link

funivan commented May 7, 2013

it will be nice to add any attribute to any block
For example:

# h1 title # [::attibute]
## h2 title ## [::attibute]

[attribute::][data-tip="test"]

And it convert to

<h1 data-tip="test">h1 title</h1>
<h2 data-tip="test">h2 title</h2>

@michelf
Copy link
Owner

michelf commented May 11, 2013

If I offer this it'll be a setting on the parser, not something within the syntax. I'm seriously considering offering a callback in the API to allow altering emitted link URLs and attributes, which would make this rather easy to do.

@funivan
Copy link

funivan commented Jul 25, 2013

Callback will be great solution =)

@attiks
Copy link
Contributor

attiks commented Dec 7, 2014

I need something similar to be able to add a data- attribute to image tags, so I can post process the output to turn some images into picture.

Is there any progress on this issue?

I saw there's already support for id and class using {#id .picture} maybe we can do something like {#id .picture :data-group=test} which gets translated into <img data-group=test>

@michelf
Copy link
Owner

michelf commented Dec 7, 2014

Is there any progress on this issue?

Not much. The time can afford to put on PHP Markdown is rather limited these days.

I saw there's already support for id and class using {#id .picture} maybe we can do something like {#id .picture :data-group=test} which gets translated into <img data-group=test>

If you want to give it a shot, look at the doExtraAttributes function, as well as the id_class_attr_catch_re and id_class_attr_nocatch_re regular expressions.

@jeffmcneill
Copy link
Contributor

Google is strongly recommending href attributes. Some solution is needed. https://developers.google.com/search/docs/advanced/guidelines/qualify-outbound-links

@michelf
Copy link
Owner

michelf commented Jan 8, 2021

This should have been closed earlier. You can write [link](url){rel=nofollow} using the MarkdownExtra parser since 2014.

@michelf michelf closed this as completed Jan 8, 2021
@michelf
Copy link
Owner

michelf commented Jan 8, 2021

Oh, well... maybe I closed it too soon. This is about adding the attribute to all links. It should probably work using something like the url_filter_func configuration but for the rel attribute.

@michelf michelf reopened this Jan 8, 2021
@IzzySoft
Copy link

IzzySoft commented May 7, 2021

While on it, and if it's not asked too much: I'd love to see an option to have all external links rel=nofollow by default and just mark exceptions (maybe like [link](url){rel=} to unset the attribute). Would that be possible (and feasible)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants