RatanShreshtha / DeepThought

A simple blog theme focused on writing powered by Bulma and Zola.
https://deepthought-theme.netlify.app/
MIT License
177 stars 92 forks source link

Feature Request: Link to edit blog page in GitHub #33

Closed joesan closed 3 years ago

joesan commented 3 years ago

Could we add a "Edit this Page in GitHub" link automatically to all .md files so that when clicked, the user is routed to the GitHub master branch or main branch source?

joesan commented 3 years ago

Resolved by doing the following:

Added a config element in the config.toml under [extra] like:

github_source = "https://path/to/my/github/master/content"

Then added the following to the pahe.html which is located under templates:

          <div class="content mt-2">
            {{ page.content | safe }}
            <a href="{{ config.extra.github_source }}/{{ page.relative_path }}">Edit this page on GitHub</a>
          </div>

That div class=."..." was already there, I just added the a href below that.