... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
{% capture category %}{{ post.categories | size }}{% endcapture %} |
2 |
-<h1><a href="{{ site.root }}{{ post.url }}">{{post.title}}</a></h1> |
|
2 |
+<h1><a href="{{ root_url }}{{ post.url }}">{{post.title}}</a></h1> |
|
3 | 3 |
<time datetime="{{ post.date | datetime }}" pubdate>{{ post.date | date: "<span class='month'>%b</span> <span class='day'>%d</span> <span class='year'>%Y</span>"}}</time> |
4 | 4 |
{% if category != '0' %} |
5 | 5 |
<footer> |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
{% unless page.no_header %} |
2 | 2 |
<header> |
3 | 3 |
{% if index %} |
4 |
- <h1 class="entry-title"><a href="{{ site.root }}{{ post.url }}">{{ post.title | titlecase }}</a></h1> |
|
4 |
+ <h1 class="entry-title"><a href="{{ root_url }}{{ post.url }}">{{ post.title | titlecase }}</a></h1> |
|
5 | 5 |
{% else %} |
6 | 6 |
<h1 class="entry-title">{{ page.title | titlecase }}</h1> |
7 | 7 |
{% endif %} |
... | ... |
@@ -11,10 +11,10 @@ |
11 | 11 |
</header> |
12 | 12 |
{% endunless %} |
13 | 13 |
{% if index %} |
14 |
- <div class="entry-content">{{ content | full_urls: site.root | exerpt | smart_quotes }}</div> |
|
14 |
+ <div class="entry-content">{{ content | exerpt }}</div> |
|
15 | 15 |
<footer> |
16 |
- <a rel="full-article" href="{{ site.root }}{{ post.url }}">Read on →</a> |
|
16 |
+ <a rel="full-article" href="{{ root_url }}{{ post.url }}">Read on →</a> |
|
17 | 17 |
</footer> |
18 | 18 |
{% else %} |
19 |
-<div class="entry-content">{{ content | full_urls: site.root | smart_quotes }}</div> |
|
19 |
+<div class="entry-content">{{ content }}</div> |
|
20 | 20 |
{% endif %} |
... | ... |
@@ -12,7 +12,7 @@ |
12 | 12 |
var pinboardInit = document.createElement('script'); |
13 | 13 |
pinboardInit.type = 'text/javascript'; |
14 | 14 |
pinboardInit.async = true; |
15 |
- pinboardInit.src = '{{ site.root }}/javascripts/pinboard.js'; |
|
15 |
+ pinboardInit.src = '{{ root_url }}/javascripts/pinboard.js'; |
|
16 | 16 |
document.getElementsByTagName('head')[0].appendChild(pinboardInit); |
17 | 17 |
})(); |
18 | 18 |
</script> |
... | ... |
@@ -9,7 +9,7 @@ |
9 | 9 |
getTwitterFeed("{{site.twitter_user}}", {{site.twitter_tweet_count}}, {{site.twitter_show_replies}}); |
10 | 10 |
}); |
11 | 11 |
</script> |
12 |
- <script src="{{ site.root }}/javascripts/twitter.js" type="text/javascript"> </script> |
|
12 |
+ <script src="{{ root_url }}/javascripts/twitter.js" type="text/javascript"> </script> |
|
13 | 13 |
{% if site.twitter_follow_button %} |
14 | 14 |
<a href="http://twitter.com/{{ site.twitter_user }}" class="twitter-follow-button" data-width="208px" data-show-count="{{ site.twitter_show_follower_count }}">Follow @{{ site.twitter_user }}</a> |
15 | 15 |
{% else %} |
... | ... |
@@ -19,14 +19,14 @@ |
19 | 19 |
<meta name="keywords" content="{{page.keywords}}"/> |
20 | 20 |
{% endif %} |
21 | 21 |
|
22 |
- <link href="{{ site.root }}/favicon.png" rel="shortcut icon" /> |
|
23 |
- <link href="{{ site.root }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> |
|
24 |
- <script src="{{ site.root }}/javascripts/modernizr-2.0.js"></script> |
|
22 |
+ <link href="{{ root_url }}/favicon.png" rel="shortcut icon" /> |
|
23 |
+ <link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> |
|
24 |
+ <script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script> |
|
25 | 25 |
<script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script> |
26 |
- <script src="{{ site.root }}/javascripts/octopress.js" type="text/javascript"></script> |
|
26 |
+ <script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script> |
|
27 | 27 |
<link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> |
28 | 28 |
<link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> |
29 |
- <link href="{{ site.root }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> |
|
29 |
+ <link href="{{ root_url }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> |
|
30 | 30 |
{% include google_analytics.html %} |
31 | 31 |
{% include google_plus_one.html %} |
32 | 32 |
{% include twitter_sharing.html %} |
... | ... |
@@ -6,11 +6,11 @@ |
6 | 6 |
</ul> |
7 | 7 |
<form action="{{ site.simple_search }}" method="get"> |
8 | 8 |
<fieldset role="site-search"> |
9 |
- <input type="hidden" name="q" value="site:{{ site.url | search_url }}" /> |
|
9 |
+ <input type="hidden" name="q" value="site:{{ site.url | shorthand_url }}" /> |
|
10 | 10 |
<input class="search" type="text" name="q" results="0" placeholder="Search"/> |
11 | 11 |
</fieldset> |
12 | 12 |
</form> |
13 |
-<ul role="navigation"> |
|
14 |
- <li><a href="{{ site.root }}/">Blog</a></li> |
|
15 |
- <li><a href="{{ site.root }}/blog/archives">Archives</a></li> |
|
13 |
+<ul role=main-navigation> |
|
14 |
+ <li><a href="{{ root_url }}/">Blog</a></li> |
|
15 |
+ <li><a href="{{ root_url }}/blog/archives">Archives</a></li> |
|
16 | 16 |
</ul> |
... | ... |
@@ -1,10 +1,11 @@ |
1 |
+{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %} |
|
1 | 2 |
{% include head.html %} |
2 | 3 |
<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}> |
3 | 4 |
<header>{% include header.html %}</header> |
4 | 5 |
<nav>{% include navigation.html %}</nav> |
5 | 6 |
<div id="main"> |
6 | 7 |
<div id="content"> |
7 |
- {{ content }} |
|
8 |
+ {{ content | expand_urls: root_url | smart_quotes }} |
|
8 | 9 |
{% unless page.sidebar == false %} |
9 | 10 |
<aside role=sidebar>{% include sidebar.html %}</aside> |
10 | 11 |
{% endunless %} |
... | ... |
@@ -8,7 +8,7 @@ layout: default |
8 | 8 |
<h1 class="entry-title">{{ page.title | titlecase }}</h1> |
9 | 9 |
{% if page.date %}<p class="meta">{% include post/date.html %}</p>{% endif %} |
10 | 10 |
</header> |
11 |
- {{ content | full_urls: site.root | smart_quotes }} |
|
11 |
+ {{ content }} |
|
12 | 12 |
{% unless page.footer == false %} |
13 | 13 |
<footer> |
14 | 14 |
{% if page.date %}<p class="meta">{% include post/date.html %}</p>{% endif %} |
... | ... |
@@ -14,13 +14,13 @@ footer: false |
14 | 14 |
<nav role="pagination"> |
15 | 15 |
<div> |
16 | 16 |
{% if paginator.next_page %} |
17 |
- <a class="prev" href="{{ site.root }}/page{{paginator.next_page}}/">← Older</a> |
|
17 |
+ <a class="prev" href="/page{{paginator.next_page}}/">← Older</a> |
|
18 | 18 |
{% endif %} |
19 |
- <a href="{{ site.root }}/blog/archives">Blog Archives</a> |
|
19 |
+ <a href="/blog/archives">Blog Archives</a> |
|
20 | 20 |
{% if paginator.previous_page and paginator.previous_page > 1 %} |
21 |
- <a class="next" href="{{ site.root }}/page{{paginator.previous_page}}/">Newer →</a> |
|
21 |
+ <a class="next" href="/page{{paginator.previous_page}}/">Newer →</a> |
|
22 | 22 |
{% elsif paginator.previous_page %} |
23 |
- <a class="next" href="{{ site.root }}/">Newer →</a> |
|
23 |
+ <a class="next" href="/">Newer →</a> |
|
24 | 24 |
{% endif %} |
25 | 25 |
</div> |
26 | 26 |
</nav> |
... | ... |
@@ -130,7 +130,7 @@ module Jekyll |
130 | 130 |
# |
131 | 131 |
def category_links(categories) |
132 | 132 |
dir = @context.registers[:site].config['category_dir'] |
133 |
- root_url = @context.registers[:site].config['root'] |
|
133 |
+ root_url = @context.registers[:site].config['root'].sub(/\/$/, '') |
|
134 | 134 |
categories = categories.sort!.map do |item| |
135 | 135 |
"<a class='category' href='#{root_url}/#{dir}/#{item.gsub(/_|\W/, '-')}/'>#{item}</a>" |
136 | 136 |
end |
... | ... |
@@ -20,15 +20,23 @@ module OctopressFilters |
20 | 20 |
end |
21 | 21 |
|
22 | 22 |
# Replaces relative urls with full urls |
23 |
- def full_urls(input, url='') |
|
24 |
- url ||= '' |
|
23 |
+ def expand_urls(input, url='') |
|
24 |
+ url ||= '/' |
|
25 | 25 |
input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\"'>]+)/ do |
26 | 26 |
$1+url+$3 |
27 | 27 |
end |
28 | 28 |
end |
29 | 29 |
|
30 |
- # Returns a url without the http:// for use in as a search modifier eg. 'search terms site:website.com' |
|
31 |
- def search_url(input) |
|
30 |
+ # Removes trailing forward slash from a string for easily appending url segments |
|
31 |
+ def strip_slash(input) |
|
32 |
+ if input =~ /(.+)\/$|^\/$/ |
|
33 |
+ input = $1 |
|
34 |
+ end |
|
35 |
+ input |
|
36 |
+ end |
|
37 |
+ |
|
38 |
+ # Returns a url without the protocol (http://) |
|
39 |
+ def shorthand_url(input) |
|
32 | 40 |
input.gsub /(https?:\/\/)(\S+)/ do |
33 | 41 |
$2 |
34 | 42 |
end |