chipzoller/hugo-clarity

[Feature Request] Link to Edit Page on GitHub

Open

#279 opened on Mar 26, 2022

 (2 comments) (0 reactions) (0 assignees)HTML (285 forks)batch import
enhancementgood first issue

Repository metrics

Stars
 (651 stars)
PR merge metrics
 (Avg merge 46d 5h) (1 merged PR in 30d)

Description

Discussed in https://github.com/chipzoller/hugo-clarity/discussions/244

Originally posted by joesan December 21, 2021 While I was using Zola, I had made a few changes to the theme that I used so that I can have a link at the bottom of each page that shows a link to the original content in GitHub which upon click takes the user to the GitHub project page to be forked.

As an example., here the learn theme has this GitHub link on all pages.

https://github.com/matcornic/hugo-theme-learn/blob/master/layouts/partials/header.html

Could this feature be added? It seems quite simple, but I'm not getting the settings. For example., here is the snippet that adds this to the pages:

                  <div id="top-github-link">
                    <a class="github-link" title='{{T "Edit-this-page"}}' href="{{ $.Site.Params.editURL }}{{ replace $.File.Dir "\\" "/" }}{{ $File.LogicalName }}" target="blank">
                      <i class="fas fa-code-branch"></i>
                      <span id="top-github-link-text">{{T "Edit-this-page"}}</span>
                    </a>
                  </div>

The steps should be to add this to the single.html just below this code snippet:

    <div class="post_body">
      {{- .Content }}
    </div>

Add the editURL to the params.toml. Correct?

Contributor guide