mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-24 07:30:12 +01:00
Fixed blob edit URLs for view page source button
This commit is contained in:
parent
eb5d318603
commit
c4d61cdc41
@ -41,7 +41,7 @@
|
|||||||
},
|
},
|
||||||
"edit_uri": {
|
"edit_uri": {
|
||||||
"title": "Path from repository root to directory containing Markdown",
|
"title": "Path from repository root to directory containing Markdown",
|
||||||
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/adding-a-git-repository/#edit-button",
|
"markdownDescription": "https://www.mkdocs.org/user-guide/configuration/#edit_uri",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"copyright": {
|
"copyright": {
|
||||||
|
@ -9,7 +9,12 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if "content.action.view" in features %}
|
{% if "content.action.view" in features %}
|
||||||
<a href="{{ page.edit_url | replace('edit', 'raw') }}" title="{{ lang.t('action.view') }}" class="md-content__button md-icon">
|
{% if "/blob/" in page.edit_url %}
|
||||||
|
{% set part = "blob" %}
|
||||||
|
{% else %}
|
||||||
|
{% set part = "edit" %}
|
||||||
|
{% endif %}
|
||||||
|
<a href="{{ page.edit_url | replace(part, 'raw') }}" title="{{ lang.t('action.view') }}" class="md-content__button md-icon">
|
||||||
{% set icon = config.theme.icon.view or "material/file-eye-outline" %}
|
{% set icon = config.theme.icon.view or "material/file-eye-outline" %}
|
||||||
{% include ".icons/" ~ icon ~ ".svg" %}
|
{% include ".icons/" ~ icon ~ ".svg" %}
|
||||||
</a>
|
</a>
|
||||||
|
@ -37,8 +37,13 @@
|
|||||||
|
|
||||||
<!-- View button -->
|
<!-- View button -->
|
||||||
{% if "content.action.view" in features %}
|
{% if "content.action.view" in features %}
|
||||||
|
{% if "/blob/" in page.edit_url %}
|
||||||
|
{% set part = "blob" %}
|
||||||
|
{% else %}
|
||||||
|
{% set part = "edit" %}
|
||||||
|
{% endif %}
|
||||||
<a
|
<a
|
||||||
href="{{ page.edit_url | replace('edit', 'raw') }}"
|
href="{{ page.edit_url | replace(part, 'raw') }}"
|
||||||
title="{{ lang.t('action.view') }}"
|
title="{{ lang.t('action.view') }}"
|
||||||
class="md-content__button md-icon"
|
class="md-content__button md-icon"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user