www_mycelium/templates/partials/blogSidebar.html

38 lines
1.5 KiB
HTML
Raw Normal View History

2024-05-03 20:15:09 +00:00
2024-08-18 23:29:54 +00:00
<div class="mx-8 lg:mx-4 flex flex-col mt-2 pt-6 md:mt-8">
<div class="flex flex-col mb-12">
<h4 class="text-base not-italic font-medium leading-6 text- mb-4"> FILTER POSTS BY</h4>
<a id="all" class="mb-2 text-white font-normal" href="/blog">All</a>
2024-05-03 20:15:09 +00:00
{% set taxonomy = get_taxonomy(kind="categories") %}
{% set categories = taxonomy.items %}
{% for category in categories %}
{% set path = category.name | slugify %}
{% set fullpath = "/categories/" ~ path %}
2024-08-18 23:29:54 +00:00
<a id="{{path}}" class="mb-2 text-white font-normal" href={{fullpath}}> {{category.name}} </a>
2024-05-03 20:15:09 +00:00
{% endfor %}
</div>
{% set section = get_section(path="blog/_index.md")%}
<div class="lg:pt-6 flex flex-col mb-12 w-64 mr-8 lg:mr-24">
2024-08-18 23:29:54 +00:00
<h4 class="text-base not-italic font-medium leading-6 text-white mb-6"> FEATURED POSTS</h4>
2024-05-03 20:15:09 +00:00
{% for page in section.pages %}
{% if page.extra.isFeatured %}
2024-08-18 23:29:54 +00:00
<a class="mb-3 text-gray-50" href={{page.permalink}}>{{ page.title }}</a>
2024-05-03 20:15:09 +00:00
{% endif %}
{% endfor %}
</div>
</div>
<script>
function setActiveCategory() {
let activeCategory = window.location.pathname.split("/")[2]
if (typeof activeCategory === "undefined") { activeLink = document.getElementById("all") }
else { activeLink = document.getElementById(activeCategory)}
activeLink.className = activeLink.className.replace("text-black font-normal", "text-black font-semibold");
}
setActiveCategory()
</script>