mirror of
https://github.com/ViViDboarder/Vivid-Casper.git
synced 2024-12-23 03:57:38 +00:00
228 lines
8.0 KiB
Handlebars
228 lines
8.0 KiB
Handlebars
{{!< default}}
|
|
|
|
{{!-- The tag above means: insert everything in this file
|
|
into the {body} of the default.hbs template --}}
|
|
|
|
<header class="site-header outer">
|
|
<div class="inner">
|
|
{{> "site-nav"}}
|
|
</div>
|
|
</header>
|
|
|
|
{{!-- Everything inside the #post tags pulls data from the post --}}
|
|
{{#post}}
|
|
|
|
<main id="site-main" class="site-main outer" role="main">
|
|
<div class="inner">
|
|
|
|
<article class="post-full {{post_class}} {{#unless feature_image}}no-image{{/unless}}">
|
|
|
|
<header class="post-full-header">
|
|
<section class="post-full-meta">
|
|
<time class="post-full-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date format="D MMMM YYYY"}}</time>
|
|
{{#if tags}}
|
|
<span class="date-divider">/</span> <a href="{{@blog.url}}tag/{{tags.[0].slug}}">{{tags.[0].name}}</a>
|
|
{{/if}}
|
|
</section>
|
|
<h1 class="post-full-title">{{title}}</h1>
|
|
</header>
|
|
|
|
{{#if feature_image}}
|
|
<figure class="post-full-image" style="background-image: url({{feature_image}})">
|
|
</figure>
|
|
{{/if}}
|
|
|
|
<section class="post-full-content">
|
|
{{content}}
|
|
</section>
|
|
|
|
{{!-- Email subscribe form at the bottom of the page --}}
|
|
{{#if @labs.subscribers}}
|
|
<section class="subscribe-form">
|
|
<h3 class="subscribe-form-title">Subscribe to {{@blog.title}}</h3>
|
|
<p>Get the latest posts delivered right to your inbox</p>
|
|
{{subscribe_form placeholder="youremail@example.com"}}
|
|
</section>
|
|
{{/if}}
|
|
|
|
<footer class="post-full-footer">
|
|
{{!-- Everything inside the #author tags pulls data from the author --}}
|
|
{{#author}}
|
|
|
|
<section class="author-card">
|
|
{{#if profile_image}}
|
|
<img class="author-profile-image" src="{{profile_image}}" alt="{{name}}" />
|
|
{{/if}}
|
|
<section class="author-card-content">
|
|
<h4 class="author-card-name"><a href="{{url}}">{{name}}</a></h4>
|
|
{{#if bio}}
|
|
<p>{{bio}}</p>
|
|
{{else}}
|
|
<p>Read <a href="{{url}}">more posts</a> by this author.</p>
|
|
{{/if}}
|
|
</section>
|
|
</section>
|
|
<div class="post-full-footer-right">
|
|
<a class="author-card-button" href="{{url}}">Read More</a>
|
|
</div>
|
|
|
|
{{/author}}
|
|
</footer>
|
|
|
|
{{!--
|
|
|
|
If you use Disqus comments, just uncomment this block.
|
|
The only thing you need to change is "test-apkdzgmqhj" - which
|
|
should be replaced with your own Disqus site-id.
|
|
|
|
<section class="post-full-comments">
|
|
<div id="disqus_thread"></div>
|
|
<script>
|
|
var disqus_config = function () {
|
|
this.page.url = '{{url absolute="true"}}';
|
|
this.page.identifier = 'ghost-{{id}}';
|
|
};
|
|
(function() {
|
|
var d = document, s = d.createElement('script');
|
|
s.src = 'https://test-apkdzgmqhj.disqus.com/embed.js';
|
|
s.setAttribute('data-timestamp', +new Date());
|
|
(d.head || d.body).appendChild(s);
|
|
})();
|
|
</script>
|
|
</section>
|
|
--}}
|
|
|
|
</article>
|
|
|
|
</div>
|
|
</main>
|
|
|
|
{{!-- Links to Previous/Next posts --}}
|
|
<aside class="read-next outer">
|
|
<div class="inner">
|
|
<div class="read-next-feed">
|
|
|
|
{{#get "posts" filter="tags:{{tags.[0].slug}}+id:-{{id}}" limit="3"}}
|
|
<article class="read-next-card"
|
|
{{#if ../tags.[0].feature_image}}
|
|
style="background-image: url({{../tags.[0].feature_image}})"
|
|
{{else}}
|
|
{{#if @blog.cover_image}}
|
|
style="background-image: url({{@blog.cover_image}})"{{/if}}
|
|
{{/if}}
|
|
>
|
|
<header class="read-next-card-header">
|
|
<small class="read-next-card-header-sitetitle">— {{@blog.title}} —</small>
|
|
<h3 class="read-next-card-header-title"><a href="{{@blog.url}}tag/{{../tags.[0].slug}}/">{{../tags.[0].name}}</a></h3>
|
|
</header>
|
|
<div class="read-next-divider">{{> "icons/infinity"}}</div>
|
|
<div class="read-next-card-content">
|
|
<ul>
|
|
{{#foreach posts}}
|
|
<li><a href="{{url}}">{{title}}</a></li>
|
|
{{/foreach}}
|
|
</ul>
|
|
</div>
|
|
<footer class="read-next-card-footer">
|
|
<a href="{{@blog.url}}tag/{{../tags.[0].slug}}/">{{plural meta.pagination.total empty='No posts' singular='% post' plural='See all % posts'}} →</a>
|
|
</footer>
|
|
</article>
|
|
{{/get}}
|
|
|
|
{{!-- If there's a next post, display it using the same markup included from - partials/post-card.hbs --}}
|
|
{{#next_post}}
|
|
{{> "post-card"}}
|
|
{{/next_post}}
|
|
|
|
{{!-- If there's a previous post, display it using the same markup included from - partials/post-card.hbs --}}
|
|
{{#prev_post}}
|
|
{{> "post-card"}}
|
|
{{/prev_post}}
|
|
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
|
|
{{!-- Floating header which appears on-scroll, included from includes/floating-header.hbs --}}
|
|
{{> floating-header}}
|
|
|
|
{{/post}}
|
|
|
|
{{!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs --}}
|
|
{{#contentFor "scripts"}}
|
|
<script>
|
|
// TODO: SOMEONE PLEASE REFACTOR THIS SHITSHOW? 😭
|
|
// Note: Scroll performance is poor in Safari
|
|
$(document).ready(function(){
|
|
$(function() {
|
|
// Start fitVids
|
|
var $postContent = $(".post-full-content");
|
|
$postContent.fitVids();
|
|
// End fitVids
|
|
|
|
// Start show/hide floating header
|
|
$(window).scroll(function() {
|
|
var header = $(".floating-header");
|
|
var title = $(".post-full-title");
|
|
var trigger = title.offset().top;
|
|
var scroll = $(window).scrollTop();
|
|
|
|
if (scroll >= trigger + title.height() + 35 ) {
|
|
header.addClass("floating-active");
|
|
} else {
|
|
header.removeClass("floating-active");
|
|
}
|
|
});
|
|
// End show/hide floating header
|
|
});
|
|
|
|
// Start scroll-progress bar
|
|
// Source: https://codepen.io/pankajparashar/pen/towxF
|
|
// Markup: floating-header.hbs
|
|
var getMax = function(){
|
|
return $(document).height() - $(window).height();
|
|
}
|
|
|
|
var getValue = function(){
|
|
return $(window).scrollTop();
|
|
}
|
|
|
|
if('max' in document.createElement('progress')){
|
|
var progressBar = $('progress');
|
|
progressBar.attr({ max: getMax() });
|
|
|
|
$(document).on('scroll', function(){
|
|
progressBar.attr({ value: getValue() });
|
|
});
|
|
|
|
$(window).resize(function(){
|
|
progressBar.attr({ max: getMax(), value: getValue() });
|
|
});
|
|
}
|
|
else {
|
|
var progressBar = $('.progress-bar'),
|
|
max = getMax(),
|
|
value, width;
|
|
|
|
var getWidth = function(){
|
|
value = getValue();
|
|
width = (value/max) * 100;
|
|
width = width + '%';
|
|
return width;
|
|
}
|
|
|
|
var setWidth = function(){
|
|
progressBar.css({ width: getWidth() });
|
|
}
|
|
|
|
$(document).on('scroll', setWidth);
|
|
$(window).on('resize', function(){
|
|
max = getMax();
|
|
setWidth();
|
|
});
|
|
}
|
|
// End scroll-progress bar
|
|
});
|
|
</script>
|
|
{{/contentFor}}
|