Replies: 1 comment
-
I found a solution testing the template locally with topobon scripts and chatGPT. I write this HTML button and extract the relative path with JS inside <div class="content">
<button id="editButton" style="margin-top: 10px;">Edit on GitHub</button>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
var path = window.location.pathname;
var editButton = document.getElementById('editButton');
editButton.setAttribute('onclick', "window.location.href='https://www.github.com/user/wiki-vault/blob/main/" + path + "'");
});
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using Digital Garden template to create a static site using Obsidian. I have hosted and the deployed the site on GitHub. And i want to create a button to edit the site as vault similar to Microsoft Docs, where docs are hosted on GitHub and can be edited.
One method is to manually add an HTML button to each note that links to note editing on GitHub.
But I want to create something more simple using a script that do this for all the notes. I'm thinking of a header slot inside the template in
src/site/_includes/components/user/notes/header/edit-note.njk
that reder an edit button that redirects each note to the editing page on https://github.com/wiki/wiki-vault/blob/main/.Can someone help me to write the script in nunjucks.
Im trying locallty this code generated by chatGPT, but does not work.
Beta Was this translation helpful? Give feedback.
All reactions