diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-05 08:43:04 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-05 08:43:04 +0200 |
| commit | 880f1ce121434e641c09f63e43ab08a2beaa83d4 (patch) | |
| tree | 09ec0b198d7852d8ca57a8c87d8b430ae44f4690 /assets | |
| parent | 474b8f177078cfdc2d4342e9ead4d505afa02d62 (diff) | |
| download | danixxyz-theme-880f1ce121434e641c09f63e43ab08a2beaa83d4.tar.gz danixxyz-theme-880f1ce121434e641c09f63e43ab08a2beaa83d4.zip | |
feat: add filter functionality, archetypes, and sample content
- 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 <noreply@anthropic.com>
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/js/filters.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/assets/js/filters.js b/assets/js/filters.js new file mode 100644 index 0000000..64d9c57 --- /dev/null +++ b/assets/js/filters.js @@ -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' }); + }); + }); +})(); |
