Adding publication date and support for hiding with internal tags, fixes #13

This commit is contained in:
Jean Viscogliosi-Pate 2024-08-31 19:39:33 -07:00
parent 3c4bcc3070
commit 05e7316870
6 changed files with 32 additions and 37 deletions

View File

@ -309,6 +309,10 @@ hr {
line-height: 32px; line-height: 32px;
} }
.tag-date {
font-size: 1.8rem;
}
.tag-desc { .tag-desc {
color: var(--color-secondary-text); color: var(--color-secondary-text);
font-weight: 600; font-weight: 600;

View File

@ -67,21 +67,6 @@
<script src="{{asset "built/main.min.js"}}"></script> <script src="{{asset "built/main.min.js"}}"></script>
{{! Tocbot is used for the table of contents }}
<script src="{{asset "js/lib/tocbot.min.js"}}"></script>
<script>
tocbot.init({
// Where to render the table of contents.
tocSelector: '.gh-toc',
// Where to grab the headings to build the table of contents.
contentSelector: '.gh-content',
// Which headings to grab inside of the contentSelector element.
headingSelector: 'h1, h2',
// Ensure correct positioning
hasInnerContainers: true,
});
</script>
{{#if @custom.oneko}} {{#if @custom.oneko}}
<script src="{{asset "js/oneko.js"}}"></script> <script src="{{asset "js/oneko.js"}}"></script>
{{/if}} {{/if}}

View File

@ -1,18 +0,0 @@
{{#if feature_image}}
<figure class="gh-article-image{{#if feature_image_caption}} has-caption{{/if}}">
<img
srcset="{{img_url feature_image size="s"}} 300w,
{{img_url feature_image size="m"}} 720w,
{{img_url feature_image size="l"}} 960w,
{{img_url feature_image size="xl"}} 1200w,
{{img_url feature_image size="xxl"}} 2000w,
{{img_url feature_image}}"
sizes="(max-width: 1200px) 100vw, 1200px"
src="{{img_url feature_image size="xl"}}"
alt="{{title}}"
>
{{#if feature_image_caption}}
<figcaption>{{feature_image_caption}}</figcaption>
{{/if}}
</figure>
{{/if}}

View File

@ -1,9 +1,11 @@
{{!-- Outputs the descriptions of ONLY internal tags with NO icon --}} {{!-- Used for de-emphasized text after post title --}}
{{#if tags}} {{#if tags}}
{{#foreach tags visibility="internal"}} {{#foreach tags visibility="internal"}}
{{^if feature_image}} {{^if feature_image}}
{{#if description}}
{{description}} {{description}}
{{/if}} {{/if}}
{{/if}}
{{/foreach}} {{/foreach}}
{{/if}} {{/if}}

View File

@ -1,4 +1,4 @@
{{!-- Outputs a bullet list of icons and descriptions for ONLY internal tags with an icon --}} {{!-- Generates list of post information --}}
{{#if tags}} {{#if tags}}
<ul class="tag-list"> <ul class="tag-list">
@ -9,11 +9,20 @@
<use href="{{img_url feature_image}}#{{meta_description}}"> <use href="{{img_url feature_image}}#{{meta_description}}">
</svg> </svg>
<div class=tag-text> <div class="tag-text">
<p>{{description}}</p> <p>{{description}}</p>
</div> </div>
</li> </li>
{{/if}} {{/if}}
{{/foreach}} {{/foreach}}
{{!-- Adds publication date unless instructed not to --}}
{{^has tag="#hide date"}}
<li>
<div class="tag-text tag-date">
<p>{{date value format="MMM D YYYY"}}</p>
</div>
</li>
{{/has}}
</ul> </ul>
{{/if}} {{/if}}

View File

@ -30,6 +30,19 @@
{{/unless}} {{/unless}}
</section> </section>
</article> </article>
{{!-- Adds table of contents unless instructed not to --}}
{{^has tag="#hide toc"}}
<script src="{{asset "js/lib/tocbot.min.js"}}"></script>
<script>
tocbot.init({
tocSelector: '.gh-toc',
contentSelector: '.gh-content',
headingSelector: 'h1, h2',
hasInnerContainers: true,
});
</script>
{{/has}}
{{/post}} {{/post}}
</div> </div>
</main> </main>