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

Look for site.github.url if it exists #25

Merged
merged 1 commit into from
Sep 6, 2016
Merged

Conversation

parkr
Copy link
Member

@parkr parkr commented Aug 30, 2016

This fixes #17. /cc @benbalter

This requires a change in the jekyll new template, sadly, namely in the listing of site.posts. We could potentially ship an include for posts_list or something so we don't have to update it in Jekyll in the future?

---

<div class="home">

<h1 class="page-heading">Posts</h1>

{% assign custom_url = site.url | append: site.baseurl %}
{% assign full_base_url = site.github.url | default: custom_url %}
Copy link
Contributor

Choose a reason for hiding this comment

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

If the user sets a base url, wouldn't this result in http://username.github.io/project/project/?

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to assume users are going to look to the default theme as an example of how they should build their own site... I'd really rather avoid this complexity if possible. Is there any way to do this without assigns?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the user sets a base url, wouldn't this result in http://username.github.io/project/project/?

What do you mean by this? custom_url is site.url + site.baseurl, and full_base_url is site.github.url OR custom_url, if site.github.url doesn't exist.

Is there any way to do this without assigns?

We need to allow plugins or provide a filter like this in Jekyll or the jekyll-github-metadata plugin. Due to the scope at render time (starts with just the page content, then includes each successive layout in turn), we have to calculate this each time. Alternatively, Jekyll could introduce site.full_url.

@benbalter
Copy link
Contributor

LGTM.

@benbalter benbalter merged commit 5f1c2bc into master Sep 6, 2016
@benbalter benbalter deleted the site-github-url branch September 6, 2016 14:14
benbalter added a commit that referenced this pull request Sep 6, 2016
@ashmaroli
Copy link
Member

ever since this got merged, I'm no longer able to access http://localhost:4000
I have to instead go to http://localhost:4000/minima/index to reach the example site

/cc @parkr, @benbalter

Write an awesome description for your new site here. You can edit this
line in _config.yml. It will appear in your document head meta (for
Google search results) and in your feed.xml site description.
baseurl: "/minima"
Copy link
Contributor

Choose a reason for hiding this comment

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

@parkr did you mean to include a baseurl by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

No.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is useful for testing.

Copy link
Member

@ashmaroli ashmaroli Sep 6, 2016

Choose a reason for hiding this comment

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

we'll hv to update readme to reflect this change..

@anthonyjsmith
Copy link

anthonyjsmith commented Sep 12, 2016

I think that having a full URL (with site.url) in the stylesheet link causes a default Jekyll site to look for a stylesheet at http://example.com/css/main.css, which obviously doesn't exist. See this Jekyll Talk thread.

@jekyll jekyll locked and limited conversation to collaborators Apr 26, 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.

Site should look to site.github.url if it exists, and if not, fall back to baseurl
5 participants