-
Notifications
You must be signed in to change notification settings - Fork 50
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
Ugly behavior of PrettyRelativeLinks #53
Comments
Interesting. I'll disable pretty links in the next PR to hugo. Looks like #45 doesn't have an easy solution after all. |
niklasfasching
referenced
this issue
Apr 11, 2021
Hugo defaults to serving files with pretty urls [1] - this means `/posts/foo.org` is served at `/posts/foo/`. This works because servers default to serving index.html when a directory is specified and hugo renders the post to `/posts/foo/index.html` instead of `/posts/foo.html`. To make relative links work we need to (1) remove the fake `foo/` subdirectory from unrooted links and (2) replace any `.org` suffix with `/`. [1] https://gohugo.io/content-management/urls/#pretty-urls
bep
pushed a commit
to gohugoio/hugo
that referenced
this issue
Apr 12, 2021
go-org PrettyRelativeLinks rewrites relative org links by - adding `../` in front - removing any `.org` suffix This was meant to play well with hugo pretty urls (which pretty much renders posts in a subdirectory without the file suffix) and allow use of normal org file links to reference other posts. There's a lot of edge cases I didn't consider and multiple bug reports in go-org [1] later I don't think the complexity of handling those edge cases is worth it - so let's disable it. [1] - niklasfasching/go-org#53 - niklasfasching/go-org@5dadf8c (comment) - niklasfasching/go-org#51
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a problem with referring my image files with Hugo.
I tried Hugo with the following files.
(It uses go-org v1.4.0.)
The problem is:
test.png
correctly I must write[[./test-branch/test.png]]
, because[[./test.png]]
will be converted as<img src=".././test.png" alt=".././test.png" title=".././test.png" />
. I think it is ugly.test.png
, you should write[[./test.png]]
. (It might be intuitive but...)Furthermore, to refer
content2.org
you should write[[./content2]]
incontent1.org
(*2) but[[test-branch/content2]]
in_index.org
(*1), though these files are in the same directory.(And for the files in
content/
it might be even worse, especially the top URL is not/
(e.g.https://example.com/hugo/
instead ofhttps://example.com/
).)I think this behavior of the PrettyRelativeLinks is very ugly and harmful for users.
For (*1) and (*3) I want to write
[[./test.png]]
so I don't have to change anything when I change the name of the directory, even if I have to write[[../test.png]]
for (*2).FYI: With
.md
files:test.png
, you should write![Alt text](./test.png "a title")
. (of course)test.png
, you should write![Alt text](../test.png "a title")
. (../
instead of./
)It might not be intuitive, but understandable, because the URL for
content1.md
is.../test-branch/content1/
.test-leaf.png
you should write![Alt text](./test-leaf.png "a title")
. (of course)I think this behavior is reasonable.
The text was updated successfully, but these errors were encountered: