Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
198 lines (164 sloc) 7.4 KB
{{!< 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"}}
{{!-- Everything inside the #post tags pulls data from the post --}}
<main id="site-main" class="site-main outer">
<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>
<span class="date-divider">/</span> <a href="{{url}}">{{name}}</a>
<h1 class="post-full-title">{{title}}</h1>
{{#if feature_image}}
<figure class="post-full-image">
{{!-- This is a responsive image, it loads different sizes depending on device --}}
<img srcset="{{img_url feature_image size="s"}} 300w,
{{img_url feature_image size="m"}} 600w,
{{img_url feature_image size="l"}} 1000w,
{{img_url feature_image size="xl"}} 2000w" sizes="(max-width: 800px) 400px,
(max-width: 1170px) 700px,
1400px" src="{{img_url feature_image size="xl"}}" alt="{{title}}" />
<section class="post-full-content">
<div class="post-content">
{{!-- Email subscribe form at the bottom of the page --}}
{{#if @labs.subscribers}}
<section class="subscribe-form">
<h3 class="subscribe-form-title">Subscribe to {{@site.title}}</h3>
<p>Get the latest posts delivered right to your inbox</p>
{{subscribe_form placeholder=""}}
<!-- footer class="post-full-footer">
{{!-- There are two options for how we display the byline/author-info.
If the post has more than one author, we load a specific template
from includes/byline-multiple.hbs, otherwise, we just use the
default byline. --}}
{{#has author="count:>1"}}
{{> "byline-multiple"}}
{{> "byline-single"}}
{{> disqus}}
{{!-- Links to Previous/Next posts --}}
<aside class="read-next outer">
<div class="inner">
<div class="read-next-feed">
{{#if primary_tag}}
{{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related_posts|}}
{{#if related_posts}}
<article class="read-next-card" {{#if ../primary_tag.feature_image}}
style="background-image: url({{img_url ../primary_tag.feature_image size="m"}})" {{else}}
{{#if @site.cover_image}} style="background-image: url({{img_url @site.cover_image size="m"}})" {{/if}}
<header class="read-next-card-header">
<small class="read-next-card-header-sitetitle">&mdash; {{@site.title}} &mdash;</small>
<h3 class="read-next-card-header-title"><a href="{{url}}">{{name}}</a></h3>
<div class="read-next-divider">{{> "icons/infinity"}}</div>
<div class="read-next-card-content">
{{#foreach related_posts}}
<li><a href="{{url}}">{{title}}</a></li>
<footer class="read-next-card-footer">
<a href="{{#../primary_tag}}{{url}}{{/../primary_tag}}">{{plural empty='No posts' singular='% post' plural='See all % posts'}}
{{!-- If there's a next post, display it using the same markup included from - partials/post-card.hbs --}}
{{> "post-card"}}
{{!-- If there's a previous post, display it using the same markup included from - partials/post-card.hbs --}}
{{> "post-card"}}
{{!-- Floating header which appears on-scroll, included from includes/floating-header.hbs --}}
{{> floating-header}}
{{!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs --}}
{{#contentFor "scripts"}}
// NOTE: Scroll performance is poor in Safari
// - this appears to be due to the events firing much more slowly in Safari.
// Dropping the scroll event and using only a raf loop results in smoother
// scrolling but continuous processing even when not scrolling
$(document).ready(function () {
// Start fitVids
var $postContent = $(".post-full-content");
// End fitVids
var progressBar = document.querySelector('#reading-progress');
var header = document.querySelector('.floating-header');
var title = document.querySelector('.post-full-title');
var lastScrollY = window.scrollY;
var lastWindowHeight = window.innerHeight;
var lastDocumentHeight = $(document).height();
var ticking = false;
function onScroll() {
lastScrollY = window.scrollY;
function onResize() {
lastWindowHeight = window.innerHeight;
lastDocumentHeight = $(document).height();
function requestTick() {
if (!ticking) {
ticking = true;
function update() {
var trigger = title.getBoundingClientRect().top + window.scrollY;
var triggerOffset = title.offsetHeight + 35;
var progressMax = lastDocumentHeight - lastWindowHeight;
// show/hide floating header
if (lastScrollY >= trigger + triggerOffset) {
} else {
progressBar.setAttribute('max', progressMax);
progressBar.setAttribute('value', lastScrollY);
ticking = false;
window.addEventListener('scroll', onScroll, { passive: true });
window.addEventListener('resize', onResize, false);
You can’t perform that action at this time.