Skip to content

Commit

Permalink
feat(footer): add edit this page link
Browse files Browse the repository at this point in the history
  • Loading branch information
noxilixon committed Aug 26, 2024
1 parent e96a5bb commit d7353d6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ disableKinds = ['taxonomy', 'term']
secondary_font = "Arial"
mono_font = "Courier New"
primary = "#dc0067"
editURL = "https://github.com/freifunk-berlin/berlin.freifunk.net/edit/main/content"
[params.social]
github = "freifunk-berlin/"
twitter = "freifunk_berlin/"
Expand Down
44 changes: 29 additions & 15 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,34 @@
<!-- Footer Start -->
<footer class="footer footer-light footer-bar">
<div class="footer-py-30">
<div class="container text-center">
<div class="row align-items-center">
<div class="text-sm-start">
<p class="mb-0 d-flex justify-content-end">
{{ range .Site.Params.footer }}
<a href="{{ relLangURL .url }}">{{ .name }}</a>
{{ end }}
</p>
</div>
<div class="col-sm-6 mt-4 mt-sm-0 pt-2 pt-sm-0">
<!-- <p>Privacy</p> -->
</div><!--end col-->
</div><!--end row-->
</div><!--end container-->
<div class="container">
<ul class="nav align-items-center align-content-between flex-wrap">
{{ range .Site.Params.footer }}
<li class="nav-item">
<a class="mx-2" href="{{ relLangURL .url }}">{{ .name }}</a>
</li>
{{ end }}
{{ $Site := .Site }}
{{ with .File }}
<button type="button" class="btn btn-primary btn-sm d-inline-flex align-items-center ms-auto" id="edit-page-link" data-url="{{ $Site.Params.editURL }}{{ replace .Dir "\\" "/" }}{{ .LogicalName }}">
<i class="material-icons size-16 me-2">edit</i><span>Edit</span>
</button>
{{ end }}
<script>
document.addEventListener("DOMContentLoaded", function() {
var editLink = document.getElementById('edit-page-link');
if (editLink) {
var url = editLink.getAttribute('data-url');
editLink.onclick = function() {
window.open(url, '_blank');
};
}
});
</script>
</ul>
</div>
<!--end container-->
</div>
</footer><!--end footer-->
</footer>
<!--end footer-->
<!-- Footer End -->

0 comments on commit d7353d6

Please sign in to comment.