diff options
-rw-r--r-- | .themes/classic/source/_includes/archive_post.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/article.html | 8 | ||||
-rw-r--r-- | .themes/classic/source/_includes/asides/pinboard.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/asides/recent_posts.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/asides/twitter.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/head.html | 10 | ||||
-rw-r--r-- | .themes/classic/source/_includes/header.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/navigation.html | 8 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/default.html | 3 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/page.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/index.html | 8 | ||||
-rw-r--r-- | plugins/category_generator.rb | 2 | ||||
-rw-r--r-- | plugins/custom_filters.rb | 16 |
13 files changed, 38 insertions, 29 deletions
diff --git a/.themes/classic/source/_includes/archive_post.html b/.themes/classic/source/_includes/archive_post.html index 1e291c1b..b667b88b 100644 --- a/.themes/classic/source/_includes/archive_post.html +++ b/.themes/classic/source/_includes/archive_post.html @@ -1,5 +1,5 @@ {% capture category %}{{ post.categories | size }}{% endcapture %} -<h1><a href="{{ site.root }}{{ post.url }}">{{post.title}}</a></h1> +<h1><a href="{{ root_url }}{{ post.url }}">{{post.title}}</a></h1> <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> {% if category != '0' %} <footer> diff --git a/.themes/classic/source/_includes/article.html b/.themes/classic/source/_includes/article.html index a25691f8..a658e340 100644 --- a/.themes/classic/source/_includes/article.html +++ b/.themes/classic/source/_includes/article.html @@ -1,7 +1,7 @@ {% unless page.no_header %} <header> {% if index %} - <h1 class="entry-title"><a href="{{ site.root }}{{ post.url }}">{{ post.title | titlecase }}</a></h1> + <h1 class="entry-title"><a href="{{ root_url }}{{ post.url }}">{{ post.title | titlecase }}</a></h1> {% else %} <h1 class="entry-title">{{ page.title | titlecase }}</h1> {% endif %} @@ -11,10 +11,10 @@ </header> {% endunless %} {% if index %} - <div class="entry-content">{{ content | full_urls: site.root | exerpt | smart_quotes }}</div> + <div class="entry-content">{{ content | exerpt }}</div> <footer> - <a rel="full-article" href="{{ site.root }}{{ post.url }}">Read on →</a> + <a rel="full-article" href="{{ root_url }}{{ post.url }}">Read on →</a> </footer> {% else %} -<div class="entry-content">{{ content | full_urls: site.root | smart_quotes }}</div> +<div class="entry-content">{{ content }}</div> {% endif %} diff --git a/.themes/classic/source/_includes/asides/pinboard.html b/.themes/classic/source/_includes/asides/pinboard.html index bf656663..c89c3e7b 100644 --- a/.themes/classic/source/_includes/asides/pinboard.html +++ b/.themes/classic/source/_includes/asides/pinboard.html @@ -12,7 +12,7 @@ var pinboardInit = document.createElement('script'); pinboardInit.type = 'text/javascript'; pinboardInit.async = true; - pinboardInit.src = '{{ site.root }}/javascripts/pinboard.js'; + pinboardInit.src = '{{ root_url }}/javascripts/pinboard.js'; document.getElementsByTagName('head')[0].appendChild(pinboardInit); })(); </script> diff --git a/.themes/classic/source/_includes/asides/recent_posts.html b/.themes/classic/source/_includes/asides/recent_posts.html index 9b8f47a2..cc628145 100644 --- a/.themes/classic/source/_includes/asides/recent_posts.html +++ b/.themes/classic/source/_includes/asides/recent_posts.html @@ -3,7 +3,7 @@ <ul id="recent_posts"> {% for post in site.posts limit: site.recent_posts %} <li class="post"> - <a href="{{ site.root }}{{ post.url }}">{{ post.title }}</a> + <a href="{{ root_url }}{{ post.url }}">{{ post.title }}</a> </li> {% endfor %} </ul> diff --git a/.themes/classic/source/_includes/asides/twitter.html b/.themes/classic/source/_includes/asides/twitter.html index d10d9e28..fe4eda6a 100644 --- a/.themes/classic/source/_includes/asides/twitter.html +++ b/.themes/classic/source/_includes/asides/twitter.html @@ -9,7 +9,7 @@ getTwitterFeed("{{site.twitter_user}}", {{site.twitter_tweet_count}}, {{site.twitter_show_replies}}); }); </script> - <script src="{{ site.root }}/javascripts/twitter.js" type="text/javascript"> </script> + <script src="{{ root_url }}/javascripts/twitter.js" type="text/javascript"> </script> {% if site.twitter_follow_button %} <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> {% else %} diff --git a/.themes/classic/source/_includes/head.html b/.themes/classic/source/_includes/head.html index ea0cad76..34fb2222 100644 --- a/.themes/classic/source/_includes/head.html +++ b/.themes/classic/source/_includes/head.html @@ -19,14 +19,14 @@ <meta name="keywords" content="{{page.keywords}}"/> {% endif %} - <link href="{{ site.root }}/favicon.png" rel="shortcut icon" /> - <link href="{{ site.root }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> - <script src="{{ site.root }}/javascripts/modernizr-2.0.js"></script> + <link href="{{ root_url }}/favicon.png" rel="shortcut icon" /> + <link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> + <script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script> <script src="http://s3.amazonaws.com/ender-js/jeesh.min.js"></script> - <script src="{{ site.root }}/javascripts/octopress.js" type="text/javascript"></script> + <script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script> <link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> - <link href="{{ site.root }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> + <link href="{{ root_url }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> {% include google_analytics.html %} {% include google_plus_one.html %} {% include twitter_sharing.html %} diff --git a/.themes/classic/source/_includes/header.html b/.themes/classic/source/_includes/header.html index 411b6abe..35f9c059 100644 --- a/.themes/classic/source/_includes/header.html +++ b/.themes/classic/source/_includes/header.html @@ -1,5 +1,5 @@ <hgroup> - <h1><a href="{{ site.root }}/">{{ site.title }}</a></h1> + <h1><a href="{{ root_url }}/">{{ site.title }}</a></h1> {% if site.subtitle %} <h2>{{ site.subtitle }}</h2> {% endif %} diff --git a/.themes/classic/source/_includes/navigation.html b/.themes/classic/source/_includes/navigation.html index 4518fcd8..6ffe9a86 100644 --- a/.themes/classic/source/_includes/navigation.html +++ b/.themes/classic/source/_includes/navigation.html @@ -6,11 +6,11 @@ </ul> <form action="{{ site.simple_search }}" method="get"> <fieldset role="site-search"> - <input type="hidden" name="q" value="site:{{ site.url | search_url }}" /> + <input type="hidden" name="q" value="site:{{ site.url | shorthand_url }}" /> <input class="search" type="text" name="q" results="0" placeholder="Search"/> </fieldset> </form> -<ul role="navigation"> - <li><a href="{{ site.root }}/">Blog</a></li> - <li><a href="{{ site.root }}/blog/archives">Archives</a></li> +<ul role=main-navigation> + <li><a href="{{ root_url }}/">Blog</a></li> + <li><a href="{{ root_url }}/blog/archives">Archives</a></li> </ul> diff --git a/.themes/classic/source/_layouts/default.html b/.themes/classic/source/_layouts/default.html index fdb60ded..f3c24005 100644 --- a/.themes/classic/source/_layouts/default.html +++ b/.themes/classic/source/_layouts/default.html @@ -1,10 +1,11 @@ +{% capture root_url %}{{ site.root | strip_slash }}{% endcapture %} {% include head.html %} <body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == false %} class="no-sidebar" {% endif %}> <header>{% include header.html %}</header> <nav>{% include navigation.html %}</nav> <div id="main"> <div id="content"> - {{ content }} + {{ content | expand_urls: root_url | smart_quotes }} {% unless page.sidebar == false %} <aside role=sidebar>{% include sidebar.html %}</aside> {% endunless %} diff --git a/.themes/classic/source/_layouts/page.html b/.themes/classic/source/_layouts/page.html index 5749b4de..a2fc41ed 100644 --- a/.themes/classic/source/_layouts/page.html +++ b/.themes/classic/source/_layouts/page.html @@ -8,7 +8,7 @@ layout: default <h1 class="entry-title">{{ page.title | titlecase }}</h1> {% if page.date %}<p class="meta">{% include post/date.html %}</p>{% endif %} </header> - {{ content | full_urls: site.root | smart_quotes }} + {{ content }} {% unless page.footer == false %} <footer> {% if page.date %}<p class="meta">{% include post/date.html %}</p>{% endif %} diff --git a/.themes/classic/source/index.html b/.themes/classic/source/index.html index f1d97f90..4719cd12 100644 --- a/.themes/classic/source/index.html +++ b/.themes/classic/source/index.html @@ -14,13 +14,13 @@ footer: false <nav role="pagination"> <div> {% if paginator.next_page %} - <a class="prev" href="{{ site.root }}/page{{paginator.next_page}}/">← Older</a> + <a class="prev" href="/page{{paginator.next_page}}/">← Older</a> {% endif %} - <a href="{{ site.root }}/blog/archives">Blog Archives</a> + <a href="/blog/archives">Blog Archives</a> {% if paginator.previous_page and paginator.previous_page > 1 %} - <a class="next" href="{{ site.root }}/page{{paginator.previous_page}}/">Newer →</a> + <a class="next" href="/page{{paginator.previous_page}}/">Newer →</a> {% elsif paginator.previous_page %} - <a class="next" href="{{ site.root }}/">Newer →</a> + <a class="next" href="/">Newer →</a> {% endif %} </div> </nav> diff --git a/plugins/category_generator.rb b/plugins/category_generator.rb index c2e9a46e..e636781e 100644 --- a/plugins/category_generator.rb +++ b/plugins/category_generator.rb @@ -130,7 +130,7 @@ module Jekyll # def category_links(categories) dir = @context.registers[:site].config['category_dir'] - root_url = @context.registers[:site].config['root'] + root_url = @context.registers[:site].config['root'].sub(/\/$/, '') categories = categories.sort!.map do |item| "<a class='category' href='#{root_url}/#{dir}/#{item.gsub(/_|\W/, '-')}/'>#{item}</a>" end diff --git a/plugins/custom_filters.rb b/plugins/custom_filters.rb index 0a7604f7..5b49363b 100644 --- a/plugins/custom_filters.rb +++ b/plugins/custom_filters.rb @@ -20,15 +20,23 @@ module OctopressFilters end # Replaces relative urls with full urls - def full_urls(input, url='') - url ||= '' + def expand_urls(input, url='') + url ||= '/' input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\"'>]+)/ do $1+url+$3 end end - # Returns a url without the http:// for use in as a search modifier eg. 'search terms site:website.com' - def search_url(input) + # Removes trailing forward slash from a string for easily appending url segments + def strip_slash(input) + if input =~ /(.+)\/$|^\/$/ + input = $1 + end + input + end + + # Returns a url without the protocol (http://) + def shorthand_url(input) input.gsub /(https?:\/\/)(\S+)/ do $2 end |