@@ -6,8 +6,10 @@ const Nunjucks = require("nunjucks");
66const buildBreadcrumbs = require ( './src/static/js/building/breadcrumbs.js' ) ;
77const buildTreemap = require ( './src/static/js/building/treemap.js' ) ;
88const buildChangelog = require ( './src/static/js/building/changelog.js' ) ;
9+ const { buildTagWall, getRecents, getRelated, buildTimestamps } = require ( './src/static/js/building/tilling.js' ) ;
910const addAsset = require ( './src/static/js/building/linking.js' ) ;
1011const { qka, quizButtons, quizQuestions } = require ( './src/static/js/building/quizzing.js' ) ;
12+ const { buildVersionTag, buildKeywords } = require ( "./src/static/js/building/package.js" ) ;
1113
1214module . exports = function ( eleventyConfig ) {
1315 eleventyConfig . addPlugin ( EleventyRenderPlugin ) ;
@@ -20,31 +22,24 @@ module.exports = function (eleventyConfig) {
2022 eleventyConfig . setQuietMode ( true ) ;
2123 eleventyConfig . setServerOptions ( { watch : [ "src/static/css/**" ] , port : 8088 } ) ;
2224
25+ eleventyConfig . addShortcode ( "breadcrumbs" , function ( navPages ) { return buildBreadcrumbs ( navPages , this . page ) } ) ;
26+ eleventyConfig . addShortcode ( "treemap" , function ( navPages ) { return buildTreemap ( navPages ) } ) ;
27+ eleventyConfig . addShortcode ( "changelog" , ( data , pkg ) => buildChangelog ( data , pkg ) ) ;
28+
29+ eleventyConfig . addShortcode ( "tilTags" , ( data ) => buildTagWall ( data ) ) ;
30+ eleventyConfig . addShortcode ( "tilRecents" , ( data ) => getRecents ( data ) ) ;
31+ eleventyConfig . addShortcode ( "tilRelated" , ( data , current ) => getRelated ( data , current ) ) ;
32+ eleventyConfig . addShortcode ( "tilTimestamps" , ( element ) => buildTimestamps ( element ) ) ;
2333
24- eleventyConfig . addShortcode ( "breadcrumbs" , function ( navPages ) { return buildBreadcrumbs ( navPages , this . page ) } ) ;
25- eleventyConfig . addShortcode ( "treemap" , function ( navPages ) { return buildTreemap ( navPages ) } ) ;
26- eleventyConfig . addShortcode ( "changelog" , ( data ) => buildChangelog ( data ) ) ;
2734 eleventyConfig . addShortcode ( "qka" , ( data ) => qka ( data ) ) ;
2835 eleventyConfig . addShortcode ( "quizButtons" , ( json ) => quizButtons ( json ) ) ;
2936 eleventyConfig . addShortcode ( "quizQuestions" , ( json ) => quizQuestions ( json ) ) ;
37+
3038 eleventyConfig . addShortcode ( "addScript" , ( filename ) => addAsset ( "script" , filename ) ) ;
3139 eleventyConfig . addShortcode ( "addStyle" , ( filename ) => addAsset ( "style" , filename ) ) ;
3240
33- eleventyConfig . addShortcode ( "keywords" , ( ) => {
34- let json = require ( './package.json' ) ;
35- if ( ! json . keywords ) {
36- console . log ( 'keywords not found in package.json' ) ;
37- return '' ;
38- }
39- return `<meta name="keywords" content="${ json . keywords . join ( ', ' ) } ">` ;
40- } ) ;
41-
42- eleventyConfig . addShortcode ( "version" , ( ) => {
43- let json = require ( './package.json' ) ;
44- let version = json . version ;
45- let channel = json . channel && json . channel !== 'RTW' ? ` (${ json . channel } )` : '' ;
46- return `<a id="version-tag" href="/changelog/">${ version } ${ channel } </a>` ;
47- } ) ;
41+ eleventyConfig . addShortcode ( "keywords" , ( pkg ) => buildKeywords ( pkg ) ) ;
42+ eleventyConfig . addShortcode ( "version" , ( pkg ) => buildVersionTag ( pkg ) ) ;
4843
4944
5045 eleventyConfig . setLibrary ( "njk" , new Nunjucks . Environment (
0 commit comments