mirror of
https://github.com/danog/sass-site.git
synced 2024-11-27 12:35:03 +01:00
231bc2b807
* main: Fix remaining blog issues First round of blog review. addressed style review comments sort out permalinks sort out permalinks Remove extra console log add author and date to individual blogs add blog.11tydate.yml file truncate html and date filters more blog edits components all working, need author and date subtitle
30 lines
889 B
TypeScript
30 lines
889 B
TypeScript
interface Page {
|
|
url: string | false;
|
|
fileSlug: string;
|
|
filePathStem: string;
|
|
date: Date;
|
|
inputPath: string;
|
|
outputPath: string | false;
|
|
outputFileExtension: string;
|
|
}
|
|
|
|
/**
|
|
* Removes leading id (e.g. `001-`) from blog filenames.
|
|
*/
|
|
export const getBlogSlug = (page: Page) => page.fileSlug.replace(/^(\d*-)/, '');
|
|
|
|
/**
|
|
* Indicates whether the given page is part of the JS API documentation.
|
|
*/
|
|
export const isTypedoc = (page: Page) =>
|
|
page.url ? page.url.startsWith('/documentation/js-api/') : false;
|
|
|
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access,
|
|
@typescript-eslint/no-unsafe-call,
|
|
@typescript-eslint/no-explicit-any */
|
|
export default function pagesPlugin(eleventyConfig: any) {
|
|
// filters...
|
|
eleventyConfig.addLiquidFilter('getBlogSlug', getBlogSlug);
|
|
eleventyConfig.addLiquidFilter('isTypedoc', isTypedoc);
|
|
}
|