فهرست منبع

feat: add git branch option for editing pages

George 6 سال پیش
والد
کامیت
e9ffc5bd9f
2فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 1 1
      exampleSite/config/_default/params.toml
  2. 1 1
      layouts/partials/edit_page.html

+ 1 - 1
exampleSite/config/_default/params.toml

@@ -45,7 +45,7 @@ privacy_pack = false
 
 # Enable visitors to edit pages?
 # `repo` defines the repository URL. `editable` defines which page types can be edited.
-edit_page = {repo_url = "https://github.com/gcushen/hugo-academic", editable = {docs = true, page = false, post = false}}
+edit_page = {repo_url = "https://github.com/gcushen/hugo-academic", repo_branch = "master", editable = {docs = true, page = false, post = false}}
 
 # Date and time format (refer to https://sourcethemes.com/academic/docs/customization/#date-format )
 #   Examples: "Mon, Jan 2, 2006" or "2006-01-02"

+ 1 - 1
layouts/partials/edit_page.html

@@ -1,6 +1,6 @@
 {{ if site.Params.edit_page.repo_url | and (index site.Params.edit_page.editable .Type) | and (ne .Params.editable false) | or .Params.editable }}
 <p class="edit-page">
-  <a href="{{site.Params.edit_page.repo_url}}/blob/master/content/{{.File.Path}}">
+  <a href="{{site.Params.edit_page.repo_url}}/blob/{{site.Params.edit_page.repo_branch | default "master"}}/content/{{.File.Path}}">
     <i class="fas fa-pen pr-2"></i>{{ i18n "edit_page" | default "Edit this page" }}
   </a>
 </p>