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
|
// add collection for pages
|
||||||
config.addCollection('pages', (collection) => {
|
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
|
// custom filters
|
||||||
config.addFilter("makeLowercase", (value) => {
|
config.addFilter("makeLowercase", (value) => {
|
||||||
if (typeof value === 'string' || value instanceof String) {
|
if (typeof value === 'string' || value instanceof String) {
|
||||||
return value.toLowerCase()
|
return value.toLowerCase()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// added passthrough for global assets
|
// added passthrough for global assets
|
||||||
config.addPassthroughCopy("assets")
|
config.addPassthroughCopy("assets")
|
||||||
// added passthrough for images in their respective folders
|
// added passthrough for images in their respective folders
|
||||||
config.addPassthroughCopy("_content/**/images/**")
|
config.addPassthroughCopy("_content/**/images/**")
|
||||||
|
|
||||||
// reutrn updated config
|
// reutrn updated config
|
||||||
return {
|
return {
|
||||||
dir: {
|
dir: {
|
||||||
input: "_content", // content
|
input: "_content", // content
|
||||||
includes: "../_includes", // templates
|
includes: "../_includes", // templates
|
||||||
output: "_site", // rendered site
|
output: "_site", // rendered site
|
||||||
data: "../_data" // global data files
|
data: "../_data" // global data files
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ imgFeat: /work/images/container2mvmnts/DSC_7873.jpg
|
||||||
gallery:
|
gallery:
|
||||||
- /work/images/container2mvmnts/DSC_7864.jpg
|
- /work/images/container2mvmnts/DSC_7864.jpg
|
||||||
- /work/images/container2mvmnts/DSC_7865.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>
|
<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
|
title: stone throw
|
||||||
layout: page.njk
|
layout: page.njk
|
||||||
imgFeat: /work/images/stoneThrow/scanPage.png
|
imgFeat: /work/images/stoneThrow/scanPage.png
|
||||||
gallery:
|
sort: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
# stone throw
|
# stone throw
|
||||||
|
|
Loading…
Reference in New Issue