Add Post Tag display

This commit is contained in:
Ben Goldsworthy 2021-01-09 10:35:19 +00:00
parent bb9dc6816e
commit 3c30f664b8
2 changed files with 42 additions and 15 deletions

View File

@ -320,7 +320,7 @@ html {
align-items: center; align-items: center;
grid-template-areas: grid-template-areas:
"post-content-header post-content" "post-content-header post-content"
" post-toc post-content" " post-meta post-content"
" . post-content"; " . post-content";
} }
} }
@ -378,25 +378,39 @@ html {
grid-area: post-date; grid-area: post-date;
} }
#split-page #post-toc { #split-page #post-meta {
grid-area: post-toc; grid-area: post-meta;
width: 100%; width: 100%;
text-align: left; text-align: left;
} }
#split-page #post-toc > h1 { #split-page #post-meta > h1 {
border-bottom: 2px inset var(--dark); border-bottom: 2px inset var(--dark);
margin-top: 0.5em; margin-top: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
line-height: 1.2em; line-height: 1.2em;
text-align: center; text-align: left;
} }
#split-page #post-toc > ol > li { #split-page #post-meta h2 {
margin-top: 0.5em;
font-size: 1.4em;
margin-bottom: 0.5em;
line-height: 1.2em;
text-align: left;
}
#split-page #post-meta > #post-contents > ol > li {
margin-top: 0.5em; margin-top: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
#split-page #post-meta > #post-tags > a {
margin-top: 0.2em;
margin-left: 1em;
}
#split-page > #wrapper > .body { #split-page > #wrapper > .body {
grid-area: post-content; grid-area: post-content;
display: block; display: block;

View File

@ -64,7 +64,7 @@
<li><?php echo $notes ?></li> <li><?php echo $notes ?></li>
<?php endif; ?> <?php endif; ?>
<?php if ($license = get_post_meta(get_the_ID(), 'License', true)): ?> <?php if ($license = get_post_meta(get_the_ID(), 'License', true)): ?>
<li>This work is licensed under <?php echo $license ?>. <a href="https://bengoldsworthy.uk/2018/03/copywrong/">Sorry about that</a>.</li> <li>This work is licensed under <?php echo $license ?>. <a href="/2018/03/copywrong/">Sorry about that</a>.</li>
<?php endif; ?> <?php endif; ?>
</ul> </ul>
</div> </div>
@ -79,15 +79,28 @@
?> ?>
</main><!-- .entry-content --> </main><!-- .entry-content -->
<footer id="post-toc"> <footer id="post-meta">
<h1>Post Meta</h1>
<?php if ($content = get_post_meta(get_the_ID(), 'ToC1', true)): ?> <?php if ($content = get_post_meta(get_the_ID(), 'ToC1', true)): ?>
<h1>Contents</h1> <section id="post-contents">
<ol> <h2>Contents</h2>
<?php $i = 1; ?> <ol>
<?php while($content = get_post_meta(get_the_ID(), 'ToC'.$i, true)): ?> <?php $i = 1; ?>
<li><a href="#section-<?php echo $i++ ?>"><?php echo $content ?></a></li> <?php while($content = get_post_meta(get_the_ID(), 'ToC'.$i, true)): ?>
<?php endwhile; ?> <li><a href="#section-<?php echo $i++ ?>"><?php echo $content ?></a></li>
</ol> <?php endwhile; ?>
</ol>
</section>
<?php endif; ?>
<?php if ($tags = get_the_tags(get_the_ID())): ?>
<section id="post-tags">
<h2>Tags</h2>
<?php foreach ($tags as $tag): ?>
<a href="<?php echo get_tag_link($tag->term_id) ?>" title="<?php echo $tag->name ?> Tag" class="tag-link">
<?php echo $tag->name ?>
</a>
<?php endforeach; ?>
</section>
<?php endif; ?> <?php endif; ?>
</footer> </footer>
</article><!-- #post-## --> </article><!-- #post-## -->