Skip to content

Commit 6823f05

Browse files
committed
dx: add edit links for docs and blog pages #265
Made-with: Cursor
1 parent 68deb29 commit 6823f05

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

mkdocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
site_name: Open Science Labs
22
site_url: https://opensciencelabs.org
33

4+
# Repository / edit links (used to build "Edit this page on GitHub" URLs)
5+
repo_url: https://github.com/OpenScienceLabs/opensciencelabs.github.io
6+
edit_uri: edit/main/
7+
48
docs_dir: pages
59
site_dir: build
610

theme/base.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,16 @@ <h2 class="accordion-header" id="h-{{ pid }}">
373373
{% block content_inner %}
374374
{{ page.content }}
375375
{% endblock content_inner %}
376+
377+
{# Inline "Edit this page on GitHub" helper. Uses MkDocs page.edit_url. #}
378+
{% if page.edit_url %}
379+
<div class="mt-4 edit-on-github">
380+
<a href="{{ page.edit_url }}" target="_blank" rel="noopener"
381+
class="edit-link small text-secondary">
382+
Found an issue? <span class="edit-link-text">Edit this page on GitHub ↗</span>
383+
</a>
384+
</div>
385+
{% endif %}
376386
</div>
377387
</div>
378388
</section>

theme/css/content.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,14 @@ blockquote{
4242
display: grid; place-items: center;
4343
}
4444
.to_top .icon { width: 24px; height: 24px; }
45+
46+
/* "Edit this page on GitHub" helper */
47+
.edit-on-github {
48+
margin-top: 1.25rem;
49+
}
50+
.edit-on-github .edit-link {
51+
text-decoration: none;
52+
}
53+
.edit-on-github .edit-link:hover {
54+
text-decoration: underline;
55+
}

0 commit comments

Comments
 (0)