You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2021/07/26 14:08:43 UTC
[sling-site] branch master updated: SLING-10668 add edit link to
each page (#66)
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-site.git
The following commit(s) were added to refs/heads/master by this push:
new bf28400 SLING-10668 add edit link to each page (#66)
bf28400 is described below
commit bf28400da3fcaadb1e53a1c92fe875047a39d9d0
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Mon Jul 26 16:07:40 2021 +0200
SLING-10668 add edit link to each page (#66)
Co-authored-by: Bertrand Delacretaz <bd...@apache.org>
---
src/main/jbake/jbake.properties | 1 +
src/main/jbake/templates/edit-brick.tpl | 8 ++++++++
src/main/jbake/templates/layout/main.tpl | 1 +
src/main/jbake/templates/page.tpl | 3 +++
4 files changed, 13 insertions(+)
diff --git a/src/main/jbake/jbake.properties b/src/main/jbake/jbake.properties
index 92d0888..2a30813 100644
--- a/src/main/jbake/jbake.properties
+++ b/src/main/jbake/jbake.properties
@@ -30,4 +30,5 @@ sling.lastCommitBaseUrl=https://github.com/apache/sling-site/commit/
template.encoding=UTF-8
repolist.path=./target/downloads/github-repositories.xml
sling.github.baseURL=https://github.com/apache/
+sling.github.baseEditingURL=https://github.com/apache/sling-site/edit/master/src/main/jbake/
default.type=page
\ No newline at end of file
diff --git a/src/main/jbake/templates/edit-brick.tpl b/src/main/jbake/templates/edit-brick.tpl
new file mode 100644
index 0000000..3b59691
--- /dev/null
+++ b/src/main/jbake/templates/edit-brick.tpl
@@ -0,0 +1,8 @@
+div(class:"editpagelink") {
+ // relativize absolute content.file path
+ def relativeSourcePath = config.sourceFolder.toPath().relativize(java.nio.file.Paths.get(content.file))
+ yield "This page can be edited on GitHub at "
+ a(href:"${config.sling_github_baseEditingURL}${relativeSourcePath}") {
+ yield "${relativeSourcePath}"
+ }
+}
\ No newline at end of file
diff --git a/src/main/jbake/templates/layout/main.tpl b/src/main/jbake/templates/layout/main.tpl
index 61def05..36e57c2 100644
--- a/src/main/jbake/templates/layout/main.tpl
+++ b/src/main/jbake/templates/layout/main.tpl
@@ -37,6 +37,7 @@ html(lang:'en'){
}//columns
footer(class:"footer") {
div(class:"content has-text-centered is-small"){
+ edit()
lastModified()
include template: 'footer.tpl'
}
diff --git a/src/main/jbake/templates/page.tpl b/src/main/jbake/templates/page.tpl
index 099e103..92da66b 100644
--- a/src/main/jbake/templates/page.tpl
+++ b/src/main/jbake/templates/page.tpl
@@ -6,6 +6,9 @@ layout 'layout/main.tpl', true,
breadcrumbs : contents {
include template : 'breadcrumbs-brick.tpl'
},
+ edit : contents {
+ include template : 'edit-brick.tpl'
+ },
tableOfContents : contents {
include template : 'toc-brick.tpl'
},