safer way to display edit this page link

This commit is contained in:
Sam Handler 2015-11-19 11:03:02 -05:00
parent 094d8b89ef
commit d1233c1d07
2 changed files with 9 additions and 3 deletions

View File

@ -324,7 +324,10 @@
<li><a href="https://docs.vagrantup.com/">Documentation</a></li>
<li><a href="https://www.vagrantup.com/about">About</a></li>
<li><a href="https://www.vagrantup.com/support">Support</a></li>
<% github_link = 'https://github.com/mitchellh/vagrant/blob/master/' + current_page.source_file.match(/website.*/)[0] %>
<% relative_path = current_page.path.match(/.*\//).to_s
file = current_page.source_file.split("/").last
github_link = "https://github.com/mitchellh/vagrant/blob/master/website/docs/source/#{relative_path}#{file}"
%>
<li class="li-under"><a href="<%= github_link %>">Edit this page</a></li>
<a href="https://www.vagrantup.com/downloads">
<li class="button inline-button">Download</li>

View File

@ -60,8 +60,11 @@
<li><a href="/about.html">About</a></li>
<li><a href="/support.html">Support</a></li>
<% if current_page.url != "/" %>
<% github_link = 'https://github.com/mitchellh/vagrant/blob/master/' + current_page.source_file.match(/website.*/)[0] %>
<li class="li-under"><a href="<%= github_link %>">Edit this page</a></li>
<% relative_path = current_page.path.match(/.*\//).to_s
file = current_page.source_file.split("/").last
github_link = "https://github.com/mitchellh/vagrant/blob/master/website/www/source/#{relative_path}#{file}"
%>
<li class="li-under"><a href="<%= github_link %>">Edit this page</a></li>
<% end %>
<a href="/downloads.html">
<li class="button inline-button">Download</li>