-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow setting of the "target" attribute for links in the editor #1403
Comments
@kyleoliveiro Setting the There may also be a way to set this in your static site generator. Hugo, for example, can automatically set all off-site links to |
Editor component is tough because they have to be blocks, and links are generally inline. At the moment they would need to enter the HTML by hand. I can think of a two potential fixes for this:
{
name: body,
label: Body,
widget: markdown,
options: { linkAttrs: { target: _blank, rel: noreferrer noopener }
}
Thoughts? |
For my use case, it's important to be able to control the target attribute for individual links, so the first approach wouldn't work. We build content-heavy static sites, so maybe creating a custom editor widget makes sense. Redactor seems to have many of the features that we need. |
What other features do you need beside the one mentioned above? |
No additional features; just need to be able to set |
Got it. Not sure what Redactor outputs, but it isn't open source and it doesn't do Markdown, so I'm not certain how it would work as a Netlify CMS widget. Solution #2 that I mentioned above should take far less effort than creating a new editor widget. If you're interested in digging in I'd be happy to advise and answer any questions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Came to this thread looking for a similar solution. @erquhart suggestion seems like the most straightforward, at least then you could break up your posts/pages into different sections (I do this so I can build up a contents table on the top of articles) and then have a I know it's not really fully answering the request, but it could be a good compromise for the SEO eggheads using netlify CMS |
I use
|
Closing as stale |
- Do you want to request a feature or report a bug?
Feature
- What is the current behavior?
When adding a link in the markdown editor, the user is only prompted for the URL of the link to be added.
- If the current behavior is a bug, please provide the steps to reproduce.
N.A.
- What is the expected behavior?
User should be prompted for the
target
attribute of the link, which can be set to one of the following values:_self
,_blank
,_parent
,_top
.Bonus points for setting
rel="noreferrer noopener"
on the link if thetarget
matches_blank
,_parent
or_top
.- Please mention your versions where applicable.
Netlify CMS version: N.A.
Browser version: N.A.
Node.JS version: N.A.
Operating System: N.A.
- Please link or paste your
config.yml
below if applicable.The text was updated successfully, but these errors were encountered: