diff --git a/_includes/ham/navbar.html b/_includes/ham/navbar.html index eb170a8..8a48ada 100644 --- a/_includes/ham/navbar.html +++ b/_includes/ham/navbar.html @@ -5,7 +5,7 @@ - + {% if site.ham.site_icon != null %} {{ site.title }} {% endif %}{{ site.title }} diff --git a/_includes/ham/sidebar.html b/_includes/ham/sidebar.html index 7b6bc18..abe172b 100644 --- a/_includes/ham/sidebar.html +++ b/_includes/ham/sidebar.html @@ -2,12 +2,10 @@
{% if site.ham.site_icon != null %} - {{ site.title }} + {{ site.title }} {% endif %}{{ site.title }} - +
diff --git a/_layouts/default.html b/_layouts/default.html index 0f10182..a5e1a2c 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -67,7 +67,7 @@ document.getElementById('_ham_search_input').addEventListener('change', updateSearchResultsVisibility); document.getElementById('_ham_search_input').addEventListener('input', updateSearchResultsVisibility); - + diff --git a/_layouts/page.html b/_layouts/page.html index b0a1e48..dcc2c38 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -2,10 +2,10 @@ layout: default ---
-
+
{{ content }}
-
+
{% if page.related_topics != null %}
diff --git a/assets/entry-parser.js b/assets/entry-parser.js index e84760d..40f1b29 100644 --- a/assets/entry-parser.js +++ b/assets/entry-parser.js @@ -61,12 +61,14 @@ function parseRawEntry(originalContent, onThisPageEntry, siteTitle, siteTagline) var newA = document.createElement('a'); newA.href = '#' + node.id; newA.className = 'nav-link text-truncate'; - newA.setAttribute('onclick', 'expandAccordion(\'' + currentAccordionId + '\')'); + newA.setAttribute('data-bs-dismiss', 'offcanvas'); + newA.setAttribute('data-bs-target', '#_ham_sidebar'); + newA.setAttribute('onclick', 'expandAccordion(\'' + currentAccordionId + '\', \'' + node.id + '\')'); for (j = 2; j < currentHeadingLevel; j++){ var newSpan = document.createElement('span'); if (j == currentHeadingLevel - 1) { newSpan.className = 'me-1 d-inline-block text-body-tertiary'; - newSpan.textContent = '↳'; + newSpan.innerHTML = ''; } else { newSpan.className = 'ms-3 d-inline-block'; } @@ -193,9 +195,14 @@ function autoexpandAccordion(){ } } -async function expandAccordion(id){ - var el = new bootstrap.Collapse(document.getElementById(id + "-content"), {toggle: false}); +async function expandAccordion(collapsibleId, contentId){ + var el = new bootstrap.Collapse(document.getElementById(collapsibleId + "-content"), {toggle: false}); await el.show(); + if (contentId) { + location.hash = ""; + location.hash = "#" + contentId; + scrollBy(0, -66); + } } window.addEventListener("load", autoexpandAccordion); \ No newline at end of file diff --git a/jekyll-ham.gemspec b/jekyll-ham.gemspec index fef44b5..aa61a24 100644 --- a/jekyll-ham.gemspec +++ b/jekyll-ham.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-ham" - spec.version = "1.0.1" + spec.version = "1.0.2" spec.authors = ["Reinhart Previano Koentjoro"] spec.email = ["reinhart@reinhart1010.id"]