]> danix's work - danix2-hugo-theme.git/commitdiff
feat: add filter functionality, archetypes, and sample content
authorDanilo M. <redacted>
Sun, 5 Apr 2026 06:43:04 +0000 (08:43 +0200)
committerDanilo M. <redacted>
Sun, 5 Apr 2026 06:43:04 +0000 (08:43 +0200)
- Create filters.js for post filtering by type (tech, life, quote, link, photo)
- Add article.md and page.md archetypes with appropriate fields
- Update default.md archetype with correct TOML syntax
- Create sample content for home, articles, and about pages
- Fix section.html template resource permalink syntax

Co-Authored-By: Claude Haiku 4.5 <redacted>
archetypes/article.md [new file with mode: 0644]
archetypes/default.md
archetypes/page.md [new file with mode: 0644]
assets/js/filters.js [new file with mode: 0644]
content/_index.md
content/articles/_index.md [new file with mode: 0644]
content/is/_index.md [new file with mode: 0644]
layouts/section.html

diff --git a/archetypes/article.md b/archetypes/article.md
new file mode 100644 (file)
index 0000000..477a18f
--- /dev/null
@@ -0,0 +1,11 @@
++++
+title = "{{ replace .File.ContentBaseName "-" " " | title }}"
+date = {{ .Date }}
+draft = true
+type = "tech"  # Options: tech, life, quote, link, photo
+featured = false
+image = ""  # Optional: image path or URL
+description = "Brief description of the article (2 lines max)"
++++
+
+Write your article here...
index 25b67521d3eacd6f5b65eaa1ae7f371a0c34ae93..502fd89bd2514ce06c9fb61aa5b5baa32d8261bc 100644 (file)
@@ -1,5 +1,7 @@
 +++
-date = '{{ .Date }}'
+title = "{{ replace .File.ContentBaseName "-" " " | title }}"
+date = {{ .Date }}
 draft = true
-title = '{{ replace .File.ContentBaseName "-" " " | title }}'
 +++
+
+Content here...
diff --git a/archetypes/page.md b/archetypes/page.md
new file mode 100644 (file)
index 0000000..fe37a38
--- /dev/null
@@ -0,0 +1,8 @@
++++
+title = "{{ replace .File.ContentBaseName "-" " " | title }}"
+date = {{ .Date }}
+draft = false
+type = "page"
++++
+
+Write your page content here...
diff --git a/assets/js/filters.js b/assets/js/filters.js
new file mode 100644 (file)
index 0000000..64d9c57
--- /dev/null
@@ -0,0 +1,28 @@
+// filters.js
+(function() {
+  const filterBtns = document.querySelectorAll('.filter-btn');
+  const feedList = document.getElementById('articles-feed');
+  const cards = feedList ? feedList.querySelectorAll('.post-card') : [];
+
+  if (!filterBtns.length || !cards.length) return;
+
+  filterBtns.forEach(btn => {
+    btn.addEventListener('click', function() {
+      const filter = this.dataset.filter;
+
+      // Update active button
+      filterBtns.forEach(b => b.classList.remove('active'));
+      this.classList.add('active');
+
+      // Filter cards
+      cards.forEach(card => {
+        const cardType = card.querySelector('.post-type-badge')?.classList[1];
+        const matches = filter === 'all' || cardType === filter;
+        card.style.display = matches ? '' : 'none';
+      });
+
+      // Scroll to top
+      window.scrollTo({ top: 0, behavior: 'smooth' });
+    });
+  });
+})();
index 652623b5730275f1d00b0fff889a922827024fb0..f04efe25a33e93fb12d68ea92795034413dce6b2 100644 (file)
@@ -1,9 +1,6 @@
 +++
-title = 'Home'
-date = 2023-01-01T08:00:00-07:00
-draft = false
+title = "Home"
+date = 2026-01-01T00:00:00Z
 +++
 
-Laborum voluptate pariatur ex culpa magna nostrud est incididunt fugiat
-pariatur do dolor ipsum enim. Consequat tempor do dolor eu. Non id id anim anim
-excepteur excepteur pariatur nostrud qui irure ullamco.
+This is the home page content. The landing page layout will use this, but typically you won't add much here — the hero and latest posts grid will be the main focus.
diff --git a/content/articles/_index.md b/content/articles/_index.md
new file mode 100644 (file)
index 0000000..3d43a65
--- /dev/null
@@ -0,0 +1,6 @@
++++
+title = "Articles"
+date = 2026-01-01T00:00:00Z
++++
+
+Browse all articles, organized by type. Use the filters to find what you're looking for.
diff --git a/content/is/_index.md b/content/is/_index.md
new file mode 100644 (file)
index 0000000..391d6d1
--- /dev/null
@@ -0,0 +1,8 @@
++++
+title = "About"
+date = 2026-01-01T00:00:00Z
++++
+
+Hi, I'm Danilo. I write about tech, life, and the things that matter.
+
+This is your about page. Edit this to tell your story.
index 4de7628fa8841feca4ff6114b6c74c50a6c7b4f7..8b938f3af207b4b5249eb2336ff07740a5cb942a 100644 (file)
@@ -24,6 +24,7 @@
   </div>
 
   {{ if eq .Type "articles" }}
-    <script defer src="{{ resources.Get "js/filters.js" | fingerprint | .RelPermalink }}"></script>
+    {{ $filters := resources.Get "js/filters.js" | fingerprint }}
+    <script defer src="{{ $filters.RelPermalink }}"></script>
   {{ end }}
 {{ end }}