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

Fixed links in example to be relative to current URL #336

Closed
wants to merge 2 commits into from

Conversation

astef
Copy link

@astef astef commented Sep 8, 2020

No description provided.

@coveralls
Copy link

coveralls commented Sep 8, 2020

Coverage Status

Coverage remained the same at 96.875% when pulling aec00b4 on astef:patch-1 into a7510dc on segmentio:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.875% when pulling 21ea6dc on astef:patch-1 into a7510dc on segmentio:master.

Copy link
Member

@woodyrew woodyrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Are the site based links causing an issue?
Relative links can become difficult to work with if you're re-using content throughout a site.

@@ -4,10 +4,10 @@ layout: layout.html

<h2>Read what I have to say</h2>

<a href="/posts/first-post/">First post</a>
<a href="./posts/first-post/">First post</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relative links would be better expressed as

<a href="posts/first-post/">First post</a>

@astef
Copy link
Author

astef commented Sep 9, 2020

I'm usually deploy the site to http://localhost/siteName/..., rather than top-level site with random port.

Also, my use case for the metalsmith is to generate static documentation for the existing web-site. So it is important for me to make sure it will be working on any nesting level.

And you're right about difficulties with re-using content throughout a site, Home links are still "broken" in the example, and the fix is not so trivial for them.

@webketje
Copy link
Member

@astef the better solution would be to have en ENV var defined in a .env file or set on the server, then pass to metalsmith metadata as BASE_URL and set the links to <a href="{{ BASE_URL }}/path/to/post">...</a>. Closing as this PR is no longer relevant

@webketje webketje closed this Nov 22, 2021
@astef astef deleted the patch-1 branch November 22, 2021 23:23
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

Successfully merging this pull request may close these issues.

None yet

4 participants