From 6383b80064f7087f52abf6aa81ed8763ec7dbd24 Mon Sep 17 00:00:00 2001 From: Samuel Ryan Date: Fri, 11 Dec 2015 03:02:39 +0000 Subject: [PATCH] Adds meta descriptions to status code pages and index Makes use of the first paragraph of the status code! --- build.js | 2 ++ package.json | 1 + templates/code.jade | 3 +++ templates/layout.jade | 2 ++ 4 files changed, 8 insertions(+) diff --git a/build.js b/build.js index a5ea597..2dd1e88 100644 --- a/build.js +++ b/build.js @@ -8,6 +8,7 @@ var elevate = require('metalsmith-elevate'); var ignore = require('metalsmith-ignore'); var collectionGrouping = require('metalsmith-collection-grouping'); var fingerprint = require('metalsmith-fingerprint-ignore'); +var excerpts = require('metalsmith-better-excerpts'); var metalsmith = Metalsmith(__dirname); metalsmith @@ -41,6 +42,7 @@ var metalsmith = Metalsmith(__dirname); .use(branch('**/*.md') .use(markdown()) + .use(excerpts({pruneLength: 400})) .use(layouts({ engine: 'jade', directory: 'templates', diff --git a/package.json b/package.json index 571ae47..8db4e54 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "jade": "^1.11.0", "lodash.groupby": "^3.1.1", "metalsmith": "^2.1.0", + "metalsmith-better-excerpts": "^0.1.7", "metalsmith-branch": "0.0.4", "metalsmith-collection-grouping": "^0.1.0", "metalsmith-collections": "^0.7.0", diff --git a/templates/code.jade b/templates/code.jade index 57b70bc..6cfc88f 100644 --- a/templates/code.jade +++ b/templates/code.jade @@ -3,6 +3,9 @@ extends layout.jade block title title !{code} !{title} — httpstatuses.com +block description + meta(name='description' content='HTTP Status Code ' + code + ': ' + excerpt) + block contents article.code.container h2 !{groups.codes[set].title} diff --git a/templates/layout.jade b/templates/layout.jade index 750b587..f71ab46 100644 --- a/templates/layout.jade +++ b/templates/layout.jade @@ -7,6 +7,8 @@ html(lang="en") link(rel='stylesheet', href='/' + fingerprint['style.css']) meta(name='viewport', content='width=device-width, initial-scale=1.0') meta(charset='utf-8') + block description + meta(name='description' content='HTTP Status Code directory, with definitions, details and helpful code references.') body block contents script.