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

Open links in new tab? #24

Closed
tenpast opened this issue Dec 9, 2020 · 5 comments
Closed

Open links in new tab? #24

tenpast opened this issue Dec 9, 2020 · 5 comments

Comments

@tenpast
Copy link

tenpast commented Dec 9, 2020

Hi, I'm trying to open some links from homepage.yml in a new tab. Example

In homepage.yml section:
content : " Some content [link](https://example.com] more content"

In partial.html:
{{ .content | markdownify }}

I have tried the .../layouts/_default/_markup/render-link.html workaround for Goldmark, but it does not work when passing the content through the short code as done in vex-hugo theme.

Thanks for your help!

@somratpro
Copy link
Contributor

Hello @tenpast

Try <a href="https://examplesite.com" target="_blank">link</a> this

@tenpast
Copy link
Author

tenpast commented Dec 10, 2020

Hi @somratpro

Thank you for your response.

How do I escape the quotation marks (")? Otherwise when the .yml file is parsed by Hugo it will interpret the quotation mark as part of the yaml structure and mess up the file:

content : " Some content <a href="https://examplesite.com" target="_blank">link</a> more content"

@somratpro
Copy link
Contributor

you can use single 'quote'

@tenpast
Copy link
Author

tenpast commented Dec 10, 2020

Yes, that worked, I used a single quote for the yaml content delimiter.

Thank you :)

@tenpast tenpast closed this as completed Dec 10, 2020
@tenpast
Copy link
Author

tenpast commented Dec 10, 2020

I'm adding this as a follow-up in case this question ever comes up again. Escaping single quotes has the disadvantage that any use of single quotes then becomes a problem (example, apostrophes). The way to make the above work with double quotes is to escape the double quotes with a back-slash (like so: \"). Then the content section looks something like this:

content : " Some content <a href=\"https://examplesite.com\" target=\"_blank\">link</a> more content"

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

2 participants