by {{post.author.name}}
33 | {%if post.excerpt%} 34 |{{{post.excerpt}}}
35 | {%endif%} 36 |by {{post.author.name}}
33 | {%if post.excerpt%} 34 |{{{post.excerpt}}}
35 | {%endif%} 36 |{{{ error.stack }}}14 | {%endif%} 15 | 16 | 17 | -------------------------------------------------------------------------------- /views/filters/every.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function everyNItems( index, n, base ) { 4 | base = base || 0; 5 | return index >= base && (index - base) % n === 0; 6 | } 7 | 8 | module.exports = everyNItems; 9 | -------------------------------------------------------------------------------- /views/filters/format-date.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function formatDate( date ) { 4 | if ( ! date instanceof Date ) { 5 | date = new Date( date ); 6 | } 7 | return date.toString(); 8 | } 9 | 10 | module.exports = formatDate; 11 | -------------------------------------------------------------------------------- /views/filters/get-image.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _ = require( 'lodash' ); 4 | 5 | var validSizes = [ 6 | 'large', 7 | 'medium', 8 | 'thumbnail' 9 | ]; 10 | 11 | var validProps = [ 12 | 'url', 13 | 'width', 14 | 'height' 15 | ]; 16 | 17 | /** 18 | Get the banner image URL off a CMS post's featured_image object: it will 19 | return either the URL associated with the specified image crop (defaulting 20 | to "large"), or the URL for the original image itself. 21 | 22 | @param {Object} featuredImage The featured_image property of a post object 23 | @param {String} [size] The size of the image version to retrieve (one of 24 | "thumbnail", "medium" or "large") 25 | @param {String} [prop] A property name to return: "url", "width" or "height" 26 | @return {Object} An object with url, width & height parameters 27 | */ 28 | function getImageSize( featuredImage, size, prop ) { 29 | /*jshint -W106 */// Disable underscore_case warnings: WP uses them 30 | var image = {}; 31 | 32 | if ( ! featuredImage ) { 33 | // Bad arguments: return empty object 34 | return prop ? '' : image; 35 | } 36 | 37 | if ( ! size || ! _.contains( validSizes, size ) ) { 38 | // Default size to "large" 39 | size = 'large'; 40 | } 41 | 42 | var src = featuredImage.source; 43 | var meta = featuredImage.attachment_meta; 44 | 45 | if ( ! meta || ! src ) { 46 | // Malformed: return empty object 47 | return prop ? '' : image; 48 | } 49 | 50 | var sizes = meta.sizes; 51 | 52 | if ( sizes && sizes[ size ] ) { 53 | image = _.pick( sizes[ size ], [ 54 | 'url', 55 | 'width', 56 | 'height' 57 | ]); 58 | } else { 59 | image = { 60 | url: src, 61 | width: meta.width, 62 | height: meta.height 63 | }; 64 | } 65 | 66 | return prop && _.contains( validProps, prop ) ? 67 | image[ prop ] : 68 | image; 69 | } 70 | 71 | module.exports = getImageSize; 72 | -------------------------------------------------------------------------------- /views/filters/get-month.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function getMonthFromDate( date ) { 4 | if ( ! ( date instanceof Date ) ) { 5 | date = new Date( date ); 6 | } 7 | // getMonth is 0-indexed 8 | var month = date.getMonth() + 1; 9 | // Convert to a string and pad to two digits 10 | return ( month < 10 ? '0' : '' ) + month; 11 | } 12 | 13 | module.exports = getMonthFromDate; 14 | -------------------------------------------------------------------------------- /views/filters/get-year.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function getYearFromDate( date ) { 4 | if ( ! ( date instanceof Date ) ) { 5 | date = new Date( date ); 6 | } 7 | return date.getFullYear(); 8 | } 9 | 10 | module.exports = getYearFromDate; 11 | -------------------------------------------------------------------------------- /views/filters/remove-empty-taxonomies.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _ = require( 'lodash' ); 4 | 5 | function removeEmptyTags( collection ) { 6 | return _.filter( collection, function( term ) { 7 | return term.count > 0; 8 | }); 9 | } 10 | 11 | module.exports = removeEmptyTags; 12 | -------------------------------------------------------------------------------- /views/filters/sort-by.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _ = require( 'lodash' ); 4 | 5 | function sortByFilter( collection, prop ) { 6 | return _.sortBy( collection, prop ); 7 | } 8 | 9 | module.exports = sortByFilter; 10 | -------------------------------------------------------------------------------- /views/filters/stringify.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var format = require( 'cliff' ).inspect; 4 | var stripColorCodes = require( 'stripcolorcodes' ); 5 | 6 | function stringifyFilter( values ) { 7 | return stripColorCodes( format( values ) ); 8 | } 9 | 10 | module.exports = stringifyFilter; 11 | -------------------------------------------------------------------------------- /views/index.tmpl: -------------------------------------------------------------------------------- 1 | {%extend layouts/main as content%} 2 |
by {{post.author.name}}
33 | {%if post.excerpt%} 34 |{{{post.excerpt}}}
35 | {%endif%} 36 |{{site.description}}
11 |by {{post.author.name}}
18 | 19 |