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

{{<figure>}} shortcode breaks relative links when not using uglyURLs #1898

Closed
spanezz opened this issue Feb 26, 2016 · 4 comments
Closed

{{<figure>}} shortcode breaks relative links when not using uglyURLs #1898

spanezz opened this issue Feb 26, 2016 · 4 comments
Labels

Comments

@spanezz
Copy link

spanezz commented Feb 26, 2016

Hello, and thank you for hugo.

I like to keep my pages and assets together (#330), and I'm so glad to find that it now works out of the box.

I also like to use relative paths in my pages to reference images, and ideally I could just do:

# halmerweg.md
{{< figure src="halmerweg.jpg" alt="Nice mural" >}}

However, when that becomes halmerweg/index.html, the image stays one level up, and the <img> tag that gets generated still points to just halmerweg.jpg instead of ../halmerweg.jpg.

This is somehow related to #1768.

Using relref instead the links are correct:

[internal link]({{< relref "other-post.md" >}})

renders correctly as:

<a href="/blog/full/path/other-post/">internal link</a>
@spanezz spanezz changed the title {{<figure>}} shortcode breaks relative links in when not using uglyURLs {{<figure>}} shortcode breaks relative links when not using uglyURLs Feb 26, 2016
@bep
Copy link
Member

bep commented Feb 26, 2016

{{< figure src="halmerweg.jpg" alt="Nice mural" >}}

What is this relative to?

You must either provide a URL relative to the context-root or an absolute one. There is no URL magic in the figure shortcode.

@spanezz
Copy link
Author

spanezz commented Feb 27, 2016

Oh I see. I assumed it was possible to just refer to resources relative to the current page, so to answer your question, in my example, that would have been relative to where halmerweg.md is located.

The ikiwiki that I currently use supports that, and it is a feature that I have so far relied on, because it allows me to prepare content without needing to know in advance where it's going to be located on the site.

@bep
Copy link
Member

bep commented Feb 27, 2016

There are similar discussions/issues about this. Close this as a duplicate.

@bep bep closed this as completed Feb 27, 2016
@github-actions
Copy link

github-actions bot commented Apr 9, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants