Skip to content

Commit 1c038a8

Browse files
committed
fix: sidebar and navbar
1 parent 69de1b4 commit 1c038a8

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

_includes/ham/navbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<i class="bi bi-list-nested" aria-hidden="true"></i>
66
</button>
77
</div>
8-
<a class="navbar-brand" href="#">
8+
<a class="navbar-brand" href="/">
99
{% if site.ham.site_icon != null %}
1010
<img src="{{ site.ham.site_icon }}" alt="{{ site.title }}" width="24" height="24" class="d-inline-block align-text-top">
1111
{% endif %}{{ site.title }}

_includes/ham/sidebar.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
<div class="offcanvas-header d-md-none border-bottom border-secondary border-opacity-25">
33
<a href="/" class="sidebar-brand">
44
{% if site.ham.site_icon != null %}
5-
<img src="{{ site.ham.site_icon }}" alt="{{ site.title }}">
5+
<img src="{{ site.ham.site_icon }}" alt="{{ site.title }}" width="24" height="24">
66
{% endif %}{{ site.title }}
77
</a>
8-
<button type="button" class="btn-close d-md-none" data-bs-dismiss="offcanvas" aria-label="Close" data-bs-target="#_ham_sidebar">
9-
<i class="bi bi-x-lg" aria-description="Close sidebar"></i>
10-
</button>
8+
<button type="button" class="btn-close d-md-none" aria-label="Close" data-bs-dismiss="offcanvas" data-bs-target="#_ham_sidebar"></button>
119
</div>
1210
<div class="offcanvas-body">
1311
<div class="mb-3">

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
document.getElementById('_ham_search_input').addEventListener('change', updateSearchResultsVisibility);
6868
document.getElementById('_ham_search_input').addEventListener('input', updateSearchResultsVisibility);
6969
</script>
70-
<!-- Halfmoon JS -->
70+
<!-- Bootstrap JS -->
7171
<script src="{{ site.url }}/assets/halfmoon.min.js"></script>
7272
<!-- Bootstrap JS for color modes -->
7373
<script src="{{ site.url }}/assets/bootstrap-color-modes.js"></script>

_layouts/page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
layout: default
33
---
44
<article class="row px-1 py-3">
5-
<div class="col-xl-8 collapse-group article-wrapper" id="_ham_content">
5+
<div class="col-xl-8 collapse-group article-wrapper mb-3" id="_ham_content">
66
{{ content }}
77
</div>
8-
<div class="col-xl-4">
8+
<div class="col-xl-4 mb-3">
99
{% if page.related_topics != null %}
1010
<div class="mb-3">
1111
<h5 id="related-topics" class="sidebar-title">Related Topics</h5>

assets/entry-parser.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ function parseRawEntry(originalContent, onThisPageEntry, siteTitle, siteTagline)
6161
var newA = document.createElement('a');
6262
newA.href = '#' + node.id;
6363
newA.className = 'nav-link text-truncate';
64-
newA.setAttribute('onclick', 'expandAccordion(\'' + currentAccordionId + '\')');
64+
newA.setAttribute('data-bs-dismiss', 'offcanvas');
65+
newA.setAttribute('data-bs-target', '#_ham_sidebar');
66+
newA.setAttribute('onclick', 'expandAccordion(\'' + currentAccordionId + '\', \'' + node.id + '\')');
6567
for (j = 2; j < currentHeadingLevel; j++){
6668
var newSpan = document.createElement('span');
6769
if (j == currentHeadingLevel - 1) {
6870
newSpan.className = 'me-1 d-inline-block text-body-tertiary';
69-
newSpan.textContent = '';
71+
newSpan.innerHTML = '<i class="bi bi-arrow-return-right"></i>';
7072
} else {
7173
newSpan.className = 'ms-3 d-inline-block';
7274
}
@@ -193,9 +195,14 @@ function autoexpandAccordion(){
193195
}
194196
}
195197

196-
async function expandAccordion(id){
197-
var el = new bootstrap.Collapse(document.getElementById(id + "-content"), {toggle: false});
198+
async function expandAccordion(collapsibleId, contentId){
199+
var el = new bootstrap.Collapse(document.getElementById(collapsibleId + "-content"), {toggle: false});
198200
await el.show();
201+
if (contentId) {
202+
location.hash = "";
203+
location.hash = "#" + contentId;
204+
scrollBy(0, -66);
205+
}
199206
}
200207

201208
window.addEventListener("load", autoexpandAccordion);

jekyll-ham.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Gem::Specification.new do |spec|
44
spec.name = "jekyll-ham"
5-
spec.version = "1.0.1"
5+
spec.version = "1.0.2"
66
spec.authors = ["Reinhart Previano Koentjoro"]
77
spec.email = ["reinhart@reinhart1010.id"]
88

0 commit comments

Comments
 (0)