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

Issue with relative links in :dirty format #207

Closed
eamonnsullivan opened this issue Mar 13, 2020 · 2 comments
Closed

Issue with relative links in :dirty format #207

eamonnsullivan opened this issue Mar 13, 2020 · 2 comments

Comments

@eamonnsullivan
Copy link

eamonnsullivan commented Mar 13, 2020

Apologies in advance if this isn't the right forum for this question, but I'm having some trouble understanding how the linking should work. I'm using cryogen for an AWS S3 static site. If I have a post on the front page, an <img src="img/...png"> link will work, as will a link to a previous post (posts-output/xxxx.html). However, if I click on the same post in the sidebar (under archives) neither link works.

I noticed this because I have a post in that position now, but I'm going to fix them with full (not relative links), but I want to understand whether relative links work. I'm not sure how they could ever actually work at both the index level and in the archives. Am I missing something? Is this a bug in the way index.html and posts-output/xxxx.html are generated?

Following the tips in this issue I've configured :clean-urls to :dirty and :blog-prefix to /.

@lacarmen
Copy link
Member

I'm not clear on what the problem is. Relative links will not always work; that is to be expected. If your current URL is posts-output/xxxx.html and you click on a link to posts-output/xxxx.html then your resulting location would be posts-output/posts-output/xxxx.html. However, Cryogen does not produce relative links.

However, if I click on the same post in the sidebar (under archives) neither link works.

Are you using your own custom theme? None of the provided ones have post links under an "archives" heading in the sidebar -- just the blue theme has (generated) links under a "Recent Posts" heading and those are absolute.

@eamonnsullivan
Copy link
Author

Sorry for the confusion. I'm just using blue and the heading is indeed "Recent Posts".

Cryogen does not generate any relative links. I understand that. What tripped me up is that I used relative links in my post, which worked fine running locally (lein ring server) and appeared to be fine when deployed. But it is broken when you view the same article generated for use under "Recent Posts". This is the same article, that the generator code output in two different places. I'm wondering (I'll try to do this) whether the code could be smarter and realise that the (currently active, most recent post) will be in two places in the filesystem and might need to treat any relative links differently.

As mentioned, I solved this by just using a full url in both places, but this wouldn't have worked locally (because I haven't uploaded the files yet), so can be awkward to test before publishing. For example, resizing the image.

I'm probably not making sense. I'll close this and try to submit a patch at some point.

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