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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
<meta name="description" content="{{ page.excerpt | default: site.description | strip_html | normalize_whitespace | truncate: 160 | escape }}">

<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title | escape }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">
{% assign custom_url = site.url | append: site.baseurl %}
{% assign full_base_url = site.github.url | default: custom_url %}
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: full_base_url }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: full_base_url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title | escape }}" href="{{ "/feed.xml" | prepend: full_base_url }}">
</head>
6 changes: 4 additions & 2 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

<div class="wrapper">

<a class="site-title" href="{{ site.baseurl }}/">{{ site.title | escape }}</a>
{% assign custom_url = site.url | append: site.baseurl %}
{% assign full_base_url = site.github.url | default: custom_url %}
<a class="site-title" href="{{ full_base_url }}/">{{ site.title | escape }}</a>

<nav class="site-nav">
<a href="#" class="menu-icon">
Expand All @@ -16,7 +18,7 @@
<div class="trigger">
{% for my_page in site.pages %}
{% if my_page.title %}
<a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title | escape }}</a>
<a class="page-link" href="{{ my_page.url | prepend: full_base_url }}">{{ my_page.title | escape }}</a>
{% endif %}
{% endfor %}
</div>
Expand Down
4 changes: 4 additions & 0 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "https://rubygems.org"

gem "jekyll", "~> 3.2"
gem "minima", path: "../"
18 changes: 12 additions & 6 deletions example/_config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
theme: minima
title: Your awesome title
email: your-email@domain.com
author: Mr. GitHub User
description: "Write an awesome description for your new site here. It will appear in your document head meta (for Google search results) and in your feed.xml site description."
email: your-email@domain.com
description: > # this means to ignore newlines until "baseurl:"
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..

twitter_username: jekyllrb
github_username: jekyll

collections:
posts:
permalink: /posts/:title
# Build settings
markdown: kramdown
theme: minima
exclude:
- Gemfile
- Gemfile.lock
9 changes: 6 additions & 3 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
---
layout: default
layout: page
---

<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.


<ul class="post-list">
{% for post in site.posts %}
<li>
<span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span>

<h2>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title | escape }}</a>
<a class="post-link" href="{{ post.url | prepend: full_base_url }}">{{ post.title | escape }}</a>
</h2>
</li>
{% endfor %}
</ul>

<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | prepend: site.baseurl }}">via RSS</a></p>
<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | prepend: full_base_url }}">via RSS</a></p>

</div>