From 189c48575a5fb90af7075e1b0d1a5ab1df6ae0fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tertre=20Fran=C3=A7ois?= Date: Tue, 12 Mar 2019 09:41:44 +0100 Subject: [PATCH 1/2] Links to Git file or history in the article header --- knowledge-base.yaml | 3 +++ languages.yaml | 4 ++++ templates/item.html.twig | 6 ++++++ templates/partials/git_edit_link.html.twig | 1 + templates/partials/git_history_link.html.twig | 1 + 5 files changed, 15 insertions(+) create mode 100644 templates/partials/git_edit_link.html.twig create mode 100644 templates/partials/git_history_link.html.twig diff --git a/knowledge-base.yaml b/knowledge-base.yaml index 2dd2683..51e1c05 100644 --- a/knowledge-base.yaml +++ b/knowledge-base.yaml @@ -11,6 +11,9 @@ params: authors: true # show article authors in the article header topics: true # show assigned topics in the article header time: true # show reading time in the article header + git: + tree: https://github.com/Perlkonig/grav-skeleton-knowledge-base/blob/master/ + commits: https://github.com/Perlkonig/grav-skeleton-knowledge-base/commits/master/ front: # params for the front page content maxrows: 3 # the maximum number of rows on the front page maxentries: 5 # maximum number of articles displayed for each category diff --git a/languages.yaml b/languages.yaml index 0ec14d9..d5b09ed 100644 --- a/languages.yaml +++ b/languages.yaml @@ -10,6 +10,8 @@ en: RELATED_ARTICLES: Related Articles COMMENTS: Comments CATEGORY: "Category:" + GIT_PAGE_EDIT: "Edit this page" + GIT_PAGE_HISTORY: "View history" fr: FOOTER_TEXT:

Ce thème à été avec par Perlkönig.

CATEGORIES: Catégories @@ -22,6 +24,8 @@ fr: RELATED_ARTICLES: Articles similaires COMMENTS: Commentaires CATEGORY: "Catégorie : " + GIT_PAGE_EDIT: "Editer cette page" + GIT_PAGE_HISTORY: "Voir l'historique" cs: FOOTER_TEXT:

Tento motiv byl -án s uživatelem Perlkönig.

CATEGORIES: Kategorie diff --git a/templates/item.html.twig b/templates/item.html.twig index 8e7bfa1..7f985ce 100644 --- a/templates/item.html.twig +++ b/templates/item.html.twig @@ -40,6 +40,12 @@ {% if grav.theme.config.params.articles.show.time %} {{ page.content|readingtime }} {% endif %} + {% if grav.theme.config.params.articles.git.tree %} + {% include 'partials/git_edit_link.html.twig' %} + {% endif %} + {% if grav.theme.config.params.articles.git.commits %} + {% include 'partials/git_history_link.html.twig' %} + {% endif %} {% endif %} diff --git a/templates/partials/git_edit_link.html.twig b/templates/partials/git_edit_link.html.twig new file mode 100644 index 0000000..a7ab0b8 --- /dev/null +++ b/templates/partials/git_edit_link.html.twig @@ -0,0 +1 @@ + {{ 'GIT_PAGE_EDIT'|t }} \ No newline at end of file diff --git a/templates/partials/git_history_link.html.twig b/templates/partials/git_history_link.html.twig new file mode 100644 index 0000000..712e783 --- /dev/null +++ b/templates/partials/git_history_link.html.twig @@ -0,0 +1 @@ + {{ 'GIT_PAGE_HISTORY'|t }} \ No newline at end of file From 197f84a8e4e6a280aa6f4bfe3f93b11da983d93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tertre=20Fran=C3=A7ois?= Date: Tue, 12 Mar 2019 12:57:27 +0100 Subject: [PATCH 2/2] Change regex to support both single site and multisite --- templates/partials/git_edit_link.html.twig | 2 +- templates/partials/git_history_link.html.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/partials/git_edit_link.html.twig b/templates/partials/git_edit_link.html.twig index a7ab0b8..90795fb 100644 --- a/templates/partials/git_edit_link.html.twig +++ b/templates/partials/git_edit_link.html.twig @@ -1 +1 @@ - {{ 'GIT_PAGE_EDIT'|t }} \ No newline at end of file + {{ 'GIT_PAGE_EDIT'|t }} \ No newline at end of file diff --git a/templates/partials/git_history_link.html.twig b/templates/partials/git_history_link.html.twig index 712e783..1f7cadf 100644 --- a/templates/partials/git_history_link.html.twig +++ b/templates/partials/git_history_link.html.twig @@ -1 +1 @@ - {{ 'GIT_PAGE_HISTORY'|t }} \ No newline at end of file + {{ 'GIT_PAGE_HISTORY'|t }} \ No newline at end of file