diff --git a/lib/blog/blog.rb b/lib/blog/blog.rb index 8fcad1b..049d217 100644 --- a/lib/blog/blog.rb +++ b/lib/blog/blog.rb @@ -46,6 +46,7 @@ def generate_index_year(year, haml_options) index = Index.new index.title = year.to_s index.articles = @articles.select { |a| a.date.year == year } + index.page_path = year.to_s log_string = 'Generating index year: “' + year.to_s + '” (' + index.articles.count.to_s + ' articles)' puts log_string.colorize(:light_blue) @@ -60,6 +61,7 @@ def generate_index_tag(tag, haml_options) log_string = 'Generating index tag: “' + tag + '” (' + index.articles.count.to_s + ' articles)' puts log_string.colorize(:light_blue) tag_slug = tag.downcase.gsub(' ', '-') + index.page_path = "tags/" + tag_slug index.generate_index("templates/index-custom.html.haml", RENDERED_DIRECTORY+"tags/" + tag_slug + ".html", haml_options) end diff --git a/lib/blog/index.rb b/lib/blog/index.rb index bd02c52..55f2fdc 100644 --- a/lib/blog/index.rb +++ b/lib/blog/index.rb @@ -2,6 +2,7 @@ class Index attr_accessor :articles attr_accessor :title attr_reader :blog_url + attr_accessor :page_path def initialize @articles = Array.new diff --git a/templates/article.html.haml b/templates/article.html.haml index b73b86b..caf2cbb 100644 --- a/templates/article.html.haml +++ b/templates/article.html.haml @@ -8,7 +8,6 @@ %link{:rel => "stylesheet", :type => "text/css", :href => "https://fonts.googleapis.com/css?family=Nunito:300,700"} %link{:rel => "canonical", :href => "#{web_url}"} - %link{:rel => "alternate", :type => "application/atom+xml", :href => "/blog/feed.xml", :title => "Blog (Atom)"} %link{:rel => "author", :href => "http://plus.google.com/117326560329576507699", :title => "Vincent Tourraine on Google+"} %link{:rel => "stylesheet", :href => "/blog/highlight/styles/default.css"} diff --git a/templates/index-custom.html.haml b/templates/index-custom.html.haml index 1fbd2a9..83ece3b 100644 --- a/templates/index-custom.html.haml +++ b/templates/index-custom.html.haml @@ -3,11 +3,12 @@ %head %meta{:charset => "utf-8"} %title Vincent Tourraine - Blog #{title} + %link{:rel => "stylesheet", :type => "text/css", :href => "#{blog_url}styles/default.css?d4"} / %link{:rel => "stylesheet", :type => "text/css", :href => "styles/default.css"} %link{:rel => "stylesheet", :type => "text/css", :href => "https://fonts.googleapis.com/css?family=Nunito:300,700"} - %link{:rel => "alternate", :type => "application/atom+xml", :href => "#{blog_url}feed.xml", :title => "Blog (Atom)"} + %link{:rel => "canonical", :href => "#{blog_url}#{page_path}"} %meta{:name => "viewport", :content => "width=device-width, user-scalable=no"} diff --git a/templates/index.html.haml b/templates/index.html.haml index 1cec6f5..024c906 100644 --- a/templates/index.html.haml +++ b/templates/index.html.haml @@ -3,11 +3,12 @@ %head %meta{:charset => "utf-8"} %title Vincent Tourraine - Blog + %link{:rel => "stylesheet", :type => "text/css", :href => "#{blog_url}styles/default.css?d4"} / %link{:rel => "stylesheet", :type => "text/css", :href => "styles/default.css"} %link{:rel => "stylesheet", :type => "text/css", :href => "https://fonts.googleapis.com/css?family=Nunito:300,700"} - %link{:rel => "alternate", :type => "application/atom+xml", :href => "#{blog_url}feed.xml", :title => "Blog (Atom)"} + %link{:rel => "canonical", :href => "#{blog_url}"} %meta{:name => "viewport", :content => "width=device-width, user-scalable=no"}