forked from jekyll/minima
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathedit_page_link.html
More file actions
27 lines (23 loc) · 1.05 KB
/
edit_page_link.html
File metadata and controls
27 lines (23 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{% comment %}
Edit page link - adds a link to edit this page on GitHub
Usage: {% include edit_page_link.html %}
{% endcomment %}
{% if page.path %}
{% comment %} Get repository URL - check jekyll-github-metadata first, then default {% endcomment %}
{% if site.github.repository_url %}
{% assign repo_url = site.github.repository_url %}
{% elsif site.github.repository_name %}
{% assign repo_url = "https://github.com/" | append: site.github.repository_name %}
{% else %}
{% assign repo_url = "https://github.com/abtion/guidelines" %}
{% endif %}
{% comment %} Get branch name - always use 'main' for source files {% endcomment %}
{% assign branch = "main" %}
{% comment %} Build the edit URL {% endcomment %}
{% assign edit_url = repo_url | append: "/edit/" | append: branch | append: "/" | append: page.path %}
<p style="margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e1e4e8;">
<a href="{{ edit_url }}" target="_blank" rel="noopener noreferrer" style="color: #0366d6; text-decoration: none;">
✏️ Edit this page on GitHub
</a>
</p>
{% endif %}