Skip to content

Commit d2ba4e0

Browse files
author
Tom Clark
committed
Added timestamps to links generated by the rake task. Fixes #2
1 parent 384ef4b commit d2ba4e0

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ source :rubygems
22

33
gem 'fileutils'
44
gem 'jekyll'
5-
gem 'tempfile'

Rakefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ task :update_toc do
1111

1212
site = Jekyll::Site.new(Jekyll.configuration({})) and site.read
1313

14-
pages = site.pages.reject {|p| p.data["ignore"] }.reverse
14+
pages = site.pages.reject do |page|
15+
page.data["ignore"]
16+
end.sort_by! do |page|
17+
File.mtime(File.join(FileUtils.pwd, "pages", page.name)).to_i
18+
end.reverse
1519

16-
toc_path = File.join(FileUtils.pwd, "pages", "table_of_contents.md")
20+
toc_path = File.join(FileUtils.pwd, "pages", "table-of-contents.md")
1721
temp = Tempfile.new("table_of_contents.md")
1822

1923
begin
@@ -22,7 +26,7 @@ task :update_toc do
2226
end
2327
temp.puts "<!--- BEGIN TOC -->"
2428
pages.each_with_index do |page, index|
25-
temp.puts " * [#{page.data["title"]}](#{page.destination('')})"
29+
temp.puts "* [#{page.data["title"]}](#{page.destination('')}?#{File.mtime(File.join(FileUtils.pwd, "pages", page.name)).to_i})"
2630
end
2731
temp.puts "<!--- END TOC -->"
2832
FileUtils.mv(temp.path, toc_path)

index.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,19 @@ This project originated as a full-blown rails app backed by a database, and I re
1717

1818
All Tutorials
1919
-------------
20-
21-
You can [browse all tutorials here](/pages/table-of-contents.html).
20+
You can [browse all tutorials here](/pages/table-of-contents.html?1340248769).
2221

2322
Newest Tutorials
2423
----------------
25-
26-
* [Retrieving Storm Cluster Statistics from Nimbus](/pages/retrieving-storm-data-from-nimbus.html)
27-
* [Installing MySQL](/pages/installing-mysql.html)
28-
* [Hello, World!](/pages/hello-world.html)
24+
* [Retrieving Storm Cluster Statistics from Nimbus](/pages/retrieving-storm-data-from-nimbus.html?1340248769)
25+
* [Installing MySQL](/pages/installing-mysql.html?1339980010)
26+
* [Hello, World!](/pages/hello-world.html?1339978842)
2927

3028
Examples
3129
--------
32-
33-
* [Installing MySQL](/pages/installing-mysql.html)
34-
* [Hello, World!](/pages/hello-world.html "Hello, World!")
35-
* [Syntax explanation](/pages/explanation.html)
30+
* [Installing MySQL](/pages/installing-mysql.html?1339980010)
31+
* [Hello, World!](/pages/hello-world.html?1339978842)
32+
* [Syntax explanation](/pages/explanation.html?1340248769)
3633

3734
Contributing
3835
------------

pages/table-of-contents.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ignore: true
77
This is the TOC. It should not be edited
88

99
<!--- BEGIN TOC -->
10-
* [Retrieving Storm Cluster Statistics from Nimbus](/pages/retrieving-storm-data-from-nimbus.html)
11-
* [Installing MySQL](/pages/installing-mysql.html)
12-
* [Hello, World!](/pages/hello-world.html)
10+
* [Retrieving Storm Cluster Statistics from Nimbus](/pages/retrieving-storm-data-from-nimbus.html?1340248769)
11+
* [Installing MySQL](/pages/installing-mysql.html?1339980010)
12+
* [Hello, World!](/pages/hello-world.html?1339978842)
1313
<!--- END TOC -->

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy