Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merging in user-specified-permalink stuff from bdesham.

  • Loading branch information...
commit ef8e30b6f5e066f5e67fc596c7f698f3b7e54dfa 1 parent 94883fc
@recurser authored
View
1  README.markdown
@@ -135,6 +135,7 @@ Available YAML settings
Change history
==============
+* **Version 0.1.8 (2011-08-15)** : A bunch of fixes and improvements (thanks [bdesham](https://github.com/bdesham)!).
* **Version 0.1.7 (2011-07-19)** : Sitemap base URL fix (thanks [ojilles](https://github.com/ojilles)!).
* **Version 0.1.6 (2011-05-21)** : Added optional _zip_folder_name_ YAML config setting.
* **Version 0.1.5 (2011-05-21)** : Replace github-style code markup to pygments-compatible 'highlight' format.
View
2  generate_categories.rb
@@ -1,7 +1,7 @@
# Jekyll category page generator.
# http://recursive-design.com/projects/jekyll-plugins/
#
-# Version: 0.1.7 (201107191013)
+# Version: 0.1.8 (201108151628)
#
# Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
View
2  generate_projects.rb
@@ -1,7 +1,7 @@
# Jekyll project page generator.
# http://recursive-design.com/projects/jekyll-plugins/
#
-# Version: 0.1.7 (201107191013)
+# Version: 0.1.8 (201108151628)
#
# Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
View
25 generate_sitemap.rb
@@ -1,7 +1,7 @@
# Jekyll sitemap page generator.
# http://recursive-design.com/projects/jekyll-plugins/
#
-# Version: 0.1.7 (201107191013)
+# Version: 0.1.8 (201108151628)
#
# Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
@@ -84,19 +84,24 @@ def generate_content(site)
path = page.subfolder + '/' + page.name
mod_date = File.mtime(site.source + path)
+ # Use the user-specified permalink if one is given.
+ if page.permalink
+ path = page.permalink
+ else
+ # Be smart about the output filename.
+ path.gsub!(/.md$/, ".html")
+ end
+
# Ignore SASS, SCSS, and CSS files
if path=~/.(sass|scss|css)$/
next
end
# Remove the trailing 'index.html' if there is one, and just output the folder name.
- if path=~/index.html$/
+ if path=~/\/index.html$/
path = path[0..-11]
end
- # rename any md files to html (as that is how they appear in _site)
- path.gsub!( /.md$/, ".html" )
-
if page.data.has_key?('changefreq')
changefreq = page.data["changefreq"]
else
@@ -116,7 +121,9 @@ def generate_content(site)
else
changefreq = "never"
end
- result += entry("/"+post.url, post.date, changefreq, site)
+ url = post.url
+ url = url[0..-11] if url=~/\/index.html$/
+ result += entry(url, post.date, changefreq, site)
end
result
@@ -135,9 +142,13 @@ def generate_footer
# e.g. the Googlebot). This may be specified in the page's YAML front matter. If it is not set, nothing
# is output for this property.
def entry(path, date, changefreq, site)
+ # Remove the trailing slash from the baseurl if it is present, for consistency.
+ baseurl = site.config['baseurl']
+ baseurl = baseurl[0..-2] if baseurl=~/\/$/
+
"
<url>
- <loc>#{site.config['baseurl']}#{path}</loc>
+ <loc>#{baseurl}#{path}</loc>
<lastmod>#{date.strftime("%Y-%m-%d")}</lastmod>#{if changefreq.length > 0
"\n <changefreq>#{changefreq}</changefreq>" end}
</url>"
Please sign in to comment.
Something went wrong with that request. Please try again.