From c4d61cdc419838c0c245f63ab6f26a6ca863eddc Mon Sep 17 00:00:00 2001 From: squidfunk Date: Thu, 5 Jan 2023 22:59:56 +0100 Subject: [PATCH] Fixed blob edit URLs for view page source button --- docs/schema.json | 2 +- material/partials/actions.html | 7 ++++++- src/partials/actions.html | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index f9eeec6d7..5aa399818 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -41,7 +41,7 @@ }, "edit_uri": { "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" }, "copyright": { diff --git a/material/partials/actions.html b/material/partials/actions.html index 06385a765..1031f1517 100644 --- a/material/partials/actions.html +++ b/material/partials/actions.html @@ -9,7 +9,12 @@ {% endif %} {% if "content.action.view" in features %} - + {% if "/blob/" in page.edit_url %} + {% set part = "blob" %} + {% else %} + {% set part = "edit" %} + {% endif %} + {% set icon = config.theme.icon.view or "material/file-eye-outline" %} {% include ".icons/" ~ icon ~ ".svg" %} diff --git a/src/partials/actions.html b/src/partials/actions.html index a88da7bb6..75fcb8eb5 100644 --- a/src/partials/actions.html +++ b/src/partials/actions.html @@ -37,8 +37,13 @@ {% if "content.action.view" in features %} + {% if "/blob/" in page.edit_url %} + {% set part = "blob" %} + {% else %} + {% set part = "edit" %} + {% endif %}