Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Links to article source in a git system #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions knowledge-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: <p><a href="https://github.com/Perlkonig/grav-theme-knowledge-base">Ce thème</a> à été <i class="fa fa-code"></i> avec <i class="fa fa-heart"></i> par <a href="http://perlkonig.com">Perlk&ouml;nig</a>.</p>
CATEGORIES: Catégories
Expand All @@ -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: <p><a href="https://github.com/Perlkonig/grav-theme-knowledge-base">Tento motiv</a> byl <i class="fa fa-code"></i>-án s <i class="fa fa-heart"></i> uživatelem <a href="http://perlkonig.com">Perlk&ouml;nig</a>.</p>
CATEGORIES: Kategorie
Expand Down
6 changes: 6 additions & 0 deletions templates/item.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
{% if grav.theme.config.params.articles.show.time %}
<span>{{ page.content|readingtime }}</span>
{% endif %}
{% if grav.theme.config.params.articles.git.tree %}
<span>{% include 'partials/git_edit_link.html.twig' %}</span>
{% endif %}
{% if grav.theme.config.params.articles.git.commits %}
<span>{% include 'partials/git_history_link.html.twig' %}</span>
{% endif %}
</div>
{% endif %}
</section>
Expand Down
1 change: 1 addition & 0 deletions templates/partials/git_edit_link.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a class="github-link" href="{{ grav.theme.config.params.articles.git.tree ~ ('/'~page.filePathClean)|regex_replace( '@/user(?:/sites/[a-zA-Z0-9_-]+)?/@' , '' ) }}"><i class="fa fa-git-square"></i> {{ 'GIT_PAGE_EDIT'|t }}</a>
1 change: 1 addition & 0 deletions templates/partials/git_history_link.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a class="github-link" href="{{ grav.theme.config.params.articles.git.commits ~ ('/'~page.filePathClean)|regex_replace( '@/user(?:/sites/[a-zA-Z0-9_-]+)?/@' , '' ) }}"><i class="fa fa-history"></i> {{ 'GIT_PAGE_HISTORY'|t }}</a>