feat(tags): this adds support for post, link, book, show and movie tags with a tag list view and per tag pages
This commit is contained in:
parent
3d866262ca
commit
6fdc0b56b9
35 changed files with 500 additions and 70 deletions
|
@ -23,7 +23,7 @@ schema: artist
|
|||
height="200"
|
||||
/>
|
||||
<div class="media-meta">
|
||||
<h2><?= htmlspecialchars($artist["name"]) ?></h2>
|
||||
<h2 class="page-title"><?= htmlspecialchars($artist["name"]) ?></h2>
|
||||
<span class="sub-meta country">{% tablericon "map-pin" %} <?= htmlspecialchars(
|
||||
parseCountryField($artist["country"])
|
||||
) ?></span>
|
||||
|
|
|
@ -24,7 +24,10 @@ schema: book
|
|||
height="307"
|
||||
/>
|
||||
<div class="media-meta">
|
||||
<h2><?= htmlspecialchars($book["title"]) ?></h2>
|
||||
<h2 class="page-title"><?= htmlspecialchars($book["title"]) ?></h2>
|
||||
<?php if (!empty($book["tags"])): ?>
|
||||
<?php renderTags($book["tags"] ?? []); ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($book["rating"])): ?>
|
||||
<span><?= htmlspecialchars($book["rating"]) ?></span>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -4,7 +4,7 @@ type: dynamic
|
|||
schema: genre
|
||||
---
|
||||
<a class="back-link" href="/music" title="Go back to the music index page">{% tablericon "arrow-left" %} Back to music</a>
|
||||
<h2><?= htmlspecialchars($genre["emoji"]) ?> <?= htmlspecialchars($genre["name"]) ?></h2>
|
||||
<h2 class="page-title"><?= htmlspecialchars($genre["emoji"]) ?> <?= htmlspecialchars($genre["name"]) ?></h2>
|
||||
<article class="genre-focus">
|
||||
<?php $artistCount = count($genre["artists"]); ?>
|
||||
<?php if ($artistCount > 0): ?>
|
||||
|
|
|
@ -22,7 +22,10 @@ schema: movie
|
|||
height="180"
|
||||
/>
|
||||
<div class="media-meta">
|
||||
<h2><?= htmlspecialchars($movie["title"]) ?> (<?= htmlspecialchars($movie["year"]) ?>)</h2>
|
||||
<h2 class="page-title"><?= htmlspecialchars($movie["title"]) ?> (<?= htmlspecialchars($movie["year"]) ?>)</h2>
|
||||
<?php if (!empty($movie["tags"])): ?>
|
||||
<?php renderTags($movie["tags"] ?? []); ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($movie["rating"])): ?>
|
||||
<span><?= htmlspecialchars($movie["rating"]) ?></span>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -22,7 +22,10 @@ schema: show
|
|||
height="180"
|
||||
/>
|
||||
<div class="media-meta">
|
||||
<h2><?= htmlspecialchars($show["title"]) ?> (<?= htmlspecialchars($show["year"]) ?>)</h2>
|
||||
<h2 class="page-title"><?= htmlspecialchars($show["title"]) ?> (<?= htmlspecialchars($show["year"]) ?>)</h2>
|
||||
<?php if (!empty($show["tags"])): ?>
|
||||
<?php renderTags($show["tags"] ?? []); ?>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($show["favorite"])): ?>
|
||||
<span class="sub-meta favorite">{% tablericon "heart" %} This is one of my favorite shows!</span>
|
||||
<?php endif; ?>
|
||||
|
|
50
src/pages/dynamic/tags.php.liquid
Normal file
50
src/pages/dynamic/tags.php.liquid
Normal file
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
permalink: /tags/index.php
|
||||
type: dynamic
|
||||
schema: tags
|
||||
---
|
||||
<a class="back-link" href="/tags" title="Go back to the tags index page">{% tablericon "arrow-left" %} Back to tags</a>
|
||||
<h2 class="page-title">#<?= htmlspecialchars($tag) ?></h2>
|
||||
<p><mark><?= number_format($totalCount) ?> item<?= $totalCount === 1 ? '' : 's' ?></mark> items tagged with <mark>#<?= htmlspecialchars($tag) ?></mark>. <a class="search" href="/search">You can search my site as well</a>.</p>
|
||||
<hr />
|
||||
<?php foreach ($tagged as $item): ?>
|
||||
<article class="<?= $item['type'] ?>">
|
||||
<aside>
|
||||
<?php if (!empty($item['featured'])): ?>
|
||||
<?= getTablerIcon('star') ?>
|
||||
<?php endif; ?>
|
||||
<time datetime="<?= date('F j, Y', strtotime($item['content_date'])) ?>">
|
||||
<?= date('F j, Y', strtotime($item['content_date'])) ?>
|
||||
</time>
|
||||
• <?= $item['label'] ?>
|
||||
</aside>
|
||||
<h3>
|
||||
<a href="<?= htmlspecialchars($item['url']) ?>"><?= htmlspecialchars($item['title']) ?><?php if (!empty($item['rating'])): ?> (<?= $item['rating'] ?>)<?php endif; ?></a>
|
||||
<?php if (!empty($item['author'])): ?>
|
||||
 via 
|
||||
<?php if (!empty($item['author']['url'])): ?>
|
||||
<a href="<?= $item['author']['url'] ?>">
|
||||
<?= $item['author']['name'] ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<?= $item['author']['name'] ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</h3>
|
||||
<?php if (!empty($item["tags"])): ?>
|
||||
<?php renderTags($item["tags"] ?? []); ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
<?php renderPaginator($pagination, $totalPages); ?>
|
||||
<?php
|
||||
$html = ob_get_clean();
|
||||
$htmlMin = new HtmlMin();
|
||||
$htmlMin->doOptimizeAttributes(true);
|
||||
$htmlMin->doRemoveComments(true);
|
||||
$htmlMin->doSumUpWhitespace(true);
|
||||
$htmlMin->doRemoveWhitespaceAroundTags(true);
|
||||
$htmlMin->doOptimizeViaHtmlDomParser(true);
|
||||
echo $htmlMin->minify($html);
|
||||
?>
|
|
@ -22,6 +22,9 @@ permalink: "/links/{% if pagination.pageNumber > 0 %}{{ pagination.pageNumber }}
|
|||
<article>
|
||||
<a href="{{ link.link }}" title="{{ link.title | escape }}"><strong>{{ link.title }}</strong></a>
|
||||
{% if link.author %} via <a href="{{ link.author.url }}">{{ link.author.name }}</a>{% endif %}
|
||||
{% render "blocks/tags.liquid",
|
||||
tags:link.tags
|
||||
%}
|
||||
</article>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -26,6 +26,9 @@ permalink: "/posts/{% if pagination.pageNumber > 0 %}{{ pagination.pageNumber }}
|
|||
<h3>
|
||||
<a href="{{ post.url }}">{{ post.title }}</a>
|
||||
</h3>
|
||||
{% render "blocks/tags.liquid",
|
||||
tags:post.tags
|
||||
%}
|
||||
<p>{{ post.description | markdown }}</p>
|
||||
</article>
|
||||
{% endfor %}
|
||||
|
|
|
@ -13,9 +13,10 @@ schema: blog
|
|||
{{ post.date | date: "%B %e, %Y" }}
|
||||
</time>
|
||||
</aside>
|
||||
<h3>
|
||||
{{ post.title }}
|
||||
</h3>
|
||||
<h3>{{ post.title }}</h3>
|
||||
{% render "blocks/tags.liquid",
|
||||
tags:post.tags
|
||||
%}
|
||||
<div>
|
||||
{% render "blocks/banners/old-post.liquid",
|
||||
isOldPost:post.old_post
|
||||
|
|
26
src/pages/sections/tags.html
Normal file
26
src/pages/sections/tags.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: Tags
|
||||
description: All of the tags I've applied to content on this site — posts, links, books, movies and shows.
|
||||
permalink: /tags/index.html
|
||||
---
|
||||
<h2 class="page-title">Tags</h2>
|
||||
<p>All of the tags I've applied to content on this site — posts, links, books, movies and shows. <a class="search" href="/search">You can search my site as well</a>.</p>
|
||||
<hr />
|
||||
<nav aria-label="Tag navigation">
|
||||
{% for group in tags %}
|
||||
<a href="#{{ group.letter }}">{{ group.letter }}</a>
|
||||
{% endfor %}
|
||||
</nav>
|
||||
{% for group in tags %}
|
||||
<section id="{{ group.letter }}">
|
||||
<h3>{{ group.letter }}</h3>
|
||||
<ul class="tag-list">
|
||||
{% for tag in group.tags %}
|
||||
<li>
|
||||
<a href="/tags/{{ tag.tag | downcase }}">#{{ tag.tag }}</a>
|
||||
<span class="count">({{ tag.uses }})</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endfor %}
|
|
@ -25,11 +25,9 @@ excludeFromSitemap: true
|
|||
height="480"
|
||||
/>
|
||||
</div>
|
||||
<div style="text-align:center">
|
||||
<h2>404</h2>
|
||||
<p>What kind of idiots do you have working here?</p>
|
||||
<p><a href="/">Hurry up and skip out on the room service bill!</a></p>
|
||||
</div>
|
||||
<h2 style="text-align:center">404</h2>
|
||||
<p style="text-align:center">What kind of idiots do you have working here?</p>
|
||||
<p style="text-align:center"><a href="/">Hurry up and skip out on the room service bill!</a></p>
|
||||
<script>
|
||||
const track404 = () => {
|
||||
const referrer = document.referrer || "Unknown referrer";
|
||||
|
|
|
@ -5,25 +5,10 @@ description: Search through posts and other content on my site.
|
|||
---
|
||||
|
||||
<h2 class="page-title">Search</h2>
|
||||
<p>
|
||||
You can find <a href="/posts">posts</a>, <a href="/links">links</a>,
|
||||
<a href="/music/#artists">artists</a>, genres,
|
||||
<a href="/watching#movies">movies</a>, <a href="/watching#tv">shows</a> and
|
||||
<a href="/books">books</a> via the field below (though it only surfaces movies
|
||||
and shows I've watched and books I've written something about).
|
||||
</p>
|
||||
<p>You can find <a href="/posts">posts</a>, <a href="/links">links</a>, <a href="/music/#artists">artists</a>, genres, <a href="/watching#movies">movies</a>, <a href="/watching#tv">shows</a> and <a href="/books">books</a> via the field below (though it only surfaces movies and shows I've watched and books I've written something about). <a href="/tags">You can also browse my tags list</a>.</p>
|
||||
<noscript>
|
||||
<p>
|
||||
<mark
|
||||
>If you're seeing this it means that you've (quite likely) disabled
|
||||
JavaScript (that's a totally valid choice!).</mark>
|
||||
You can search for anything on my site using the form below, but your query
|
||||
will be routed through
|
||||
<a href="https://duckduckgo.com">DuckDuckGo</a>.
|
||||
</p>
|
||||
<p>
|
||||
<mark>Type something in and hit enter.</mark>
|
||||
</p>
|
||||
<p><mark>If you're seeing this it means that you've (quite likely) disabled JavaScript (that's a totally valid choice!).</mark> You can search for anything on my site using the form below, but your query will be routed through <a href="https://duckduckgo.com">DuckDuckGo</a>.</p>
|
||||
<p><mark>Type something in and hit enter.</mark></p>
|
||||
</noscript>
|
||||
<form class="search__form" action="https://duckduckgo.com" method="get">
|
||||
<input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue