Something went wrong. Try again.
New TLE Community website using Eleventy. tlecommunity.com
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165import path from 'node:path'
import { IdAttributePlugin, InputPathToUrlTransformPlugin, HtmlBasePlugin } from '@11ty/eleventy'import { feedPlugin } from '@11ty/eleventy-plugin-rss'import pluginSyntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight'import pluginNavigation from '@11ty/eleventy-navigation'import { eleventyImageTransformPlugin } from '@11ty/eleventy-img'
import pluginFilters from './config/filters.js'
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */export default async function (eleventyConfig) { // Drafts, see also data/eleventyDataSchema.js eleventyConfig.addPreprocessor('drafts', '*', (data, content) => { if (data.draft) { data.title = `${data.title} (draft)` }
if (data.draft && process.env.ELEVENTY_RUN_MODE === 'build') { return false } })
// Site-wide static assets (fonts, favicon, interior-panel textures, logo) served at /assets/** eleventyConfig.addPassthroughCopy('assets')
// Page images live next to their page in content/<page>/images/ and are served verbatim // at /content/<page>/images/<file> (used for full-resolution download links). eleventyConfig.addPassthroughCopy('content/**/images')
eleventyConfig.addPassthroughCopy('./content/feed/pretty-atom-feed.xsl')
eleventyConfig.addWatchTarget('css/**/*.css') eleventyConfig.addWatchTarget('assets/**') eleventyConfig.addWatchTarget('content/**/*.{svg,webp,png,jpg,jpeg,gif}')
// Rebuild when the generated OpenAPI spec changes (see data/apiSpec.js). Run // `npm run spec:build` in ../api-spec to regenerate it. eleventyConfig.addWatchTarget(path.resolve(import.meta.dirname, '../api-spec/build/spec.json'))
// Per-page bundles, see https://github.com/11ty/eleventy-plugin-bundle // Bundle <style> content and adds a {% css %} paired shortcode eleventyConfig.addBundle('css', { toFileDirectory: 'dist', // Add all <style> content to `css` bundle (use <style eleventy:ignore> to opt-out) // Supported selectors: https://www.npmjs.com/package/posthtml-match-helper bundleHtmlContentFromSelector: 'style', })
// Bundle <script> content and adds a {% js %} paired shortcode eleventyConfig.addBundle('js', { toFileDirectory: 'dist', // Add all <script> content to the `js` bundle (use <script eleventy:ignore> to opt-out) // Supported selectors: https://www.npmjs.com/package/posthtml-match-helper bundleHtmlContentFromSelector: 'script', })
eleventyConfig.addPlugin(pluginSyntaxHighlight, { preAttributes: { tabindex: 0 }, }) eleventyConfig.addPlugin(pluginNavigation) eleventyConfig.addPlugin(HtmlBasePlugin) eleventyConfig.addPlugin(InputPathToUrlTransformPlugin)
eleventyConfig.addPlugin(feedPlugin, { type: 'rss', outputPath: '/rss.xml', collection: { name: 'posts', limit: 0, }, templateData: { title: 'TLE Community RSS', }, metadata: { language: 'en', title: 'TLE Community', subtitle: 'Updates from TLE Community', base: 'https://tlecommunity.com/', author: { name: 'Natalie Rose', email: 'natalie@thecommunity.com', }, }, })
eleventyConfig.addPlugin(feedPlugin, { type: 'atom', outputPath: '/feed/feed.xml', stylesheet: 'pretty-atom-feed.xsl', templateData: { title: 'TLE Community RSS', eleventyNavigation: { key: 'Feed', order: 4, }, }, collection: { name: 'posts', limit: 0, }, metadata: { language: 'en', title: 'TLE Community', subtitle: 'Updates from TLE Community', base: 'https://tlecommunity.com/', author: { name: 'Natalie Rose', email: 'natalie@thecommunity.com', }, }, })
eleventyConfig.addPlugin(eleventyImageTransformPlugin, { formats: ['avif', 'webp', 'auto'],
failOnError: false, htmlOptions: { imgAttributes: { loading: 'lazy', decoding: 'async', }, },
sharpOptions: { animated: true, }, })
// Filters eleventyConfig.addPlugin(pluginFilters)
eleventyConfig.addPlugin(IdAttributePlugin, { // API doc pages like for the Space Station Lab are combining several generic building's // endpoints into one page (ie /ssla, /sslb, /sslc, /ssld) causing the same method headers // to be generated multiple times. This is bad for accessiblity but it's only happening when the // information is being repeated. We could either display things better or ignoring the warning // alltogether (like below) will probably be sufficient. checkDuplicates: false, })
eleventyConfig.addShortcode('currentBuildDate', () => { return new Date().toISOString() })
eleventyConfig.setServerPassthroughCopyBehavior('passthrough')
eleventyConfig.setServerOptions({ port: 3000, })}
export const config = { templateFormats: ['md', 'njk', 'html', 'liquid', '11ty.js'], markdownTemplateEngine: 'njk', htmlTemplateEngine: 'njk',
dir: { input: 'content', includes: '../includes', data: '../data', output: 'public', },}