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

Include absolute path in canonical url #109

Merged
merged 2 commits into from
Jun 22, 2016
Merged

Conversation

axelheer
Copy link
Contributor

Use url and baseurl to generate prefix for redirect url, but prefer github
specific configuration if set. This leads to absolute paths as suggested.

Fixes #29

Use url and baseurl to generate prefix for redirect url, but prefer github
specific configuration if set. This leads to absolute paths as suggested.

Fixes jekyll#29
@@ -69,7 +69,7 @@ def redirect_url(site, item)
end

def redirect_prefix(site)
config_github_url(site) || config_baseurl(site) || ""
config_github_url(site) || "#{config_url(site)}#{config_baseurl(site)}"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can / should URI.join here.

@axelheer
Copy link
Contributor Author

@benbalter there you go

def config_url(site)
url = site.config.fetch('url', nil) || ""
baseurl = site.config.fetch('baseurl', nil) || ""
File.join url, baseurl
Copy link
Member

Choose a reason for hiding this comment

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

Should this be URI.join?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

URI.join seems to fail for relative urls. Thus, I went with File.join like a few lines above.

See discussion of my first commit.

Copy link
Contributor

@benbalter benbalter Jun 15, 2016

Choose a reason for hiding this comment

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

Could both of the fetches be rewritten as fetch <KEY>, "" rather than fetch <KEY>, nil || ""?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That breaks the tests. If the key is explicitly set to null, it returns null / not the default value, I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha. Makes sense. Good catch.

@parkr
Copy link
Member

parkr commented Jun 15, 2016

🆒 This LGTM. @jekyll/plugin-core, please 👀

@axelheer
Copy link
Contributor Author

@parkr is @jekyll/plugin-core a real thing? Leads to an http 404...

@pathawks
Copy link
Member

@axelheer We're real, and we're spectacular.
I guess only people already on a @jekyll team can see the members of @jekyll teams.

LGTM :shipit:

@benbalter
Copy link
Contributor

@jekyllbot: merge

@jekyllbot jekyllbot merged commit 78e84be into jekyll:master Jun 22, 2016
jekyllbot added a commit that referenced this pull request Jun 22, 2016
@axelheer axelheer deleted the issue-29 branch June 22, 2016 19:21
@jekyll jekyll locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include absolute path in canonical url
5 participants