added sorting to pages
This commit is contained in:
parent
df648d0007
commit
d1f4e6fef5
56
.eleventy.js
56
.eleventy.js
|
@ -2,28 +2,46 @@ module.exports = (config) => {
|
|||
|
||||
// add collection for pages
|
||||
config.addCollection('pages', (collection) => {
|
||||
return collection.getFilteredByGlob("**/*.md");
|
||||
let sorted = []
|
||||
let unsorted = []
|
||||
const pages = collection.getFilteredByGlob('**/*.md')
|
||||
|
||||
for (let page of pages) {
|
||||
if (page.data.sort) {
|
||||
if (sorted[page.data.sort]) {
|
||||
sorted.splice(page.data.sort)
|
||||
} else {
|
||||
sorted[page.data.sort] = page
|
||||
}
|
||||
} else {
|
||||
unsorted.push(page)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return sorted.concat(unsorted)
|
||||
})
|
||||
|
||||
// custom filters
|
||||
config.addFilter("makeLowercase", (value) => {
|
||||
if (typeof value === 'string' || value instanceof String) {
|
||||
return value.toLowerCase()
|
||||
}
|
||||
})
|
||||
// custom filters
|
||||
config.addFilter("makeLowercase", (value) => {
|
||||
if (typeof value === 'string' || value instanceof String) {
|
||||
return value.toLowerCase()
|
||||
}
|
||||
})
|
||||
|
||||
// added passthrough for global assets
|
||||
config.addPassthroughCopy("assets")
|
||||
// added passthrough for images in their respective folders
|
||||
config.addPassthroughCopy("_content/**/images/**")
|
||||
// added passthrough for global assets
|
||||
config.addPassthroughCopy("assets")
|
||||
// added passthrough for images in their respective folders
|
||||
config.addPassthroughCopy("_content/**/images/**")
|
||||
|
||||
// reutrn updated config
|
||||
return {
|
||||
dir: {
|
||||
input: "_content", // content
|
||||
includes: "../_includes", // templates
|
||||
output: "_site", // rendered site
|
||||
data: "../_data" // global data files
|
||||
}
|
||||
// reutrn updated config
|
||||
return {
|
||||
dir: {
|
||||
input: "_content", // content
|
||||
includes: "../_includes", // templates
|
||||
output: "_site", // rendered site
|
||||
data: "../_data" // global data files
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ imgFeat: /work/images/container2mvmnts/DSC_7873.jpg
|
|||
gallery:
|
||||
- /work/images/container2mvmnts/DSC_7864.jpg
|
||||
- /work/images/container2mvmnts/DSC_7865.jpg
|
||||
sort: 2
|
||||
---
|
||||
|
||||
<iframe width="560" height="315" style="width:100%; height: 20%;" sandbox="allow-same-origin allow-scripts allow-popups" src="https://p.eertu.be/videos/embed/8f786cb3-68f0-4f30-a144-77cc6dd82cad?warningTitle=0" frameborder="0" allowfullscreen></iframe>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
title: stone throw
|
||||
layout: page.njk
|
||||
imgFeat: /work/images/stoneThrow/scanPage.png
|
||||
gallery:
|
||||
sort: 1
|
||||
---
|
||||
|
||||
# stone throw
|
||||
|
|
Loading…
Reference in New Issue