SimpleX-Chat/website/.eleventy.js

61 lines
1.6 KiB
JavaScript
Raw Normal View History

migrate website to 11ty site generator (#913) * readme: fix link * add 11ty files to website folder * add web.yml * add simplex web files * add font matter to some blogs * remove unnecessary things * change few settings * add a web script * update web.yml * update image format & add an image * add font matter to blogs * update blog.html * add article layout & give that layout to blogs * update the location of _includes * update article layout * change original blog links * add styling to blog * improve the links of blogs * update web.sh * add favicon * update a tag in a blog * improve stylings of article page * improve styling of blog page * update the theme * update font matter and update links in new blog. * add style changes * apply reverse chronology sort on articles * shift blogs links back to hashes * add ids to headers & smooth scrolling * make all blog links relative * add smooth scrolling & add relative to absolute links converter * add navigation * improve mobile nav * change desktop header style * convert blogs link text to "Read More" * change desktop header style * style mobile nav * fix landing page styling * update web workflow * update web workflow * nav setting * add tailwind links * update web workflow * remove app demo folder * remove special characters from the links * fix the issue of links * make web.sh executable * update blog links * move web.sh to website folder * code style * EOLs * format index.css & contact.css * add markdown-it configuration * add outline none on focus * remove extra Javascript * make mobile nav display none by default * add permalinks to markdown files * update 11ty config * update web.sh * update article * resolve issue of special characters in header ids introduce slugify * add target _blank to whitepaper link * add last post * EOLs * try to resolve bullets issue * use markdown-it-replace-link to convert relative .md extension to .html extension * add missing images, simpligy link parsing * add CNAME file * add CNAME file, rename config * fix jumping table issue Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2022-09-10 14:26:21 +05:00
const markdownIt = require("markdown-it")
const markdownItAnchor = require("markdown-it-anchor")
const markdownItReplaceLink = require('markdown-it-replace-link')
const slugify = require("slugify")
const uri = require('fast-uri')
module.exports = function (ty) {
// Keeps the same directory structure.
ty.addPassthroughCopy("src/assets/")
ty.addPassthroughCopy("src/img")
ty.addPassthroughCopy("src/css")
ty.addPassthroughCopy("src/js")
2022-09-25 11:16:28 +01:00
ty.addPassthroughCopy("src/call")
migrate website to 11ty site generator (#913) * readme: fix link * add 11ty files to website folder * add web.yml * add simplex web files * add font matter to some blogs * remove unnecessary things * change few settings * add a web script * update web.yml * update image format & add an image * add font matter to blogs * update blog.html * add article layout & give that layout to blogs * update the location of _includes * update article layout * change original blog links * add styling to blog * improve the links of blogs * update web.sh * add favicon * update a tag in a blog * improve stylings of article page * improve styling of blog page * update the theme * update font matter and update links in new blog. * add style changes * apply reverse chronology sort on articles * shift blogs links back to hashes * add ids to headers & smooth scrolling * make all blog links relative * add smooth scrolling & add relative to absolute links converter * add navigation * improve mobile nav * change desktop header style * convert blogs link text to "Read More" * change desktop header style * style mobile nav * fix landing page styling * update web workflow * update web workflow * nav setting * add tailwind links * update web workflow * remove app demo folder * remove special characters from the links * fix the issue of links * make web.sh executable * update blog links * move web.sh to website folder * code style * EOLs * format index.css & contact.css * add markdown-it configuration * add outline none on focus * remove extra Javascript * make mobile nav display none by default * add permalinks to markdown files * update 11ty config * update web.sh * update article * resolve issue of special characters in header ids introduce slugify * add target _blank to whitepaper link * add last post * EOLs * try to resolve bullets issue * use markdown-it-replace-link to convert relative .md extension to .html extension * add missing images, simpligy link parsing * add CNAME file * add CNAME file, rename config * fix jumping table issue Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2022-09-10 14:26:21 +05:00
ty.addPassthroughCopy("src/blog/images")
ty.addPassthroughCopy("src/images")
ty.addPassthroughCopy("src/CNAME")
ty.addCollection('blogs', function (collection) {
return collection.getFilteredByGlob('src/blog/*.md').reverse()
})
ty.addWatchTarget("src/css")
ty.addWatchTarget("markdown/")
ty.addWatchTarget("components/Card.js")
const markdownLib = markdownIt({
html: true,
breaks: true,
linkify: true,
replaceLink: function (link, _env) {
let parsed = uri.parse(link)
if (parsed.scheme || parsed.host || !parsed.path.endsWith(".md")) {
return link
}
parsed.path = parsed.path.replace(/\.md$/, ".html")
return uri.serialize(parsed)
}
}).use(markdownItAnchor, {
slugify: (str) =>
slugify(str, {
lower: true,
strict: true,
})
}).use(markdownItReplaceLink)
// replace the default markdown-it instance
ty.setLibrary("md", markdownLib)
return {
dir: {
input: 'src',
includes: '_includes',
output: '_site',
},
templateFormats: ['md', 'njk', 'html'],
markdownTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
}
}