Link to URLs without ".html" at the end

This commit is contained in:
Natalie Weizenbaum 2019-11-13 14:54:11 -08:00
parent 837a475ddd
commit e704afbd74
3 changed files with 8 additions and 4 deletions

View File

@ -51,6 +51,10 @@ module SassHelpers
pages.flatten
end
def without_html(page)
url_for(page).sub(/\.html$/, '')
end
def documentation_toc
_toc_level(nil, data.documentation.toc)
end

View File

@ -6,12 +6,12 @@ per_page: 5
- if paginate && num_pages > 1
%p Page #{page_number} of #{num_pages}
%p= link_to 'Previous page', prev_page if prev_page
%p= link_to 'Previous page', without_html(prev_page) if prev_page
- page_articles.each_with_index do |article, i|
%h2= link_to article.title, article
%h2= link_to article.title, without_html(article)
= partial 'layouts/components/attribution', locals: {page: article}
= article.summary
- if paginate
%p= link_to 'Next page', next_page if next_page
%p= link_to 'Next page', without_html(next_page) if next_page

View File

@ -9,7 +9,7 @@ xml.feed xmlns: "http://www.w3.org/2005/Atom" do
blog.articles[0..5].each do |article|
xml.entry do
url = config[:host] + article.url
url = config[:host] + without_html(article.url)
xml.title article.title
xml.link href: url, rel: "alternate"
xml.id url