chug chug, working on post formatting and tag pages
This commit is contained in:
@ -3,20 +3,46 @@ import eleventyNavigationPlugin from "@11ty/eleventy-navigation";
|
||||
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
|
||||
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
|
||||
import { attrs } from "@mdit/plugin-attrs";
|
||||
import { chunk } from "lodash-es";
|
||||
|
||||
import pluginFilters from "./_config/filters.js";
|
||||
|
||||
export default async function(eleventyConfig) {
|
||||
/* Markdown HTML attribute parsing */
|
||||
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(attrs));
|
||||
|
||||
/* Filters */
|
||||
eleventyConfig.addFilter("removeBasicTags", (tags) => {
|
||||
return tags.filter(tag => ["all", "posts", "gallery", "reference"].indexOf(tag) === -1);
|
||||
/* Collections */
|
||||
/* Tag pagination */
|
||||
eleventyConfig.addCollection("tagPagination", function(collection) {
|
||||
let tagSet = new Set(collection.getAllSorted().flatMap((post) => post.data.tags || []));
|
||||
|
||||
let paginationSize = 13;
|
||||
let tagMap = [];
|
||||
let tagArray = [...tagSet];
|
||||
for( let tagName of tagArray) {
|
||||
let tagItems = collection.getFilteredByTag(tagName);
|
||||
let pagedItems = chunk(tagItems.reverse(), paginationSize); // console.log( tagName, tagItems.length, pagedItems.length );
|
||||
for( let pageNumber = 0, max = pagedItems.length; pageNumber < max; pageNumber++) {
|
||||
tagMap.push({
|
||||
tagName: tagName,
|
||||
pageNumber: pageNumber,
|
||||
pageSize: pagedItems.length,
|
||||
pageData: pagedItems[pageNumber]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//console.log( tagMap );
|
||||
return tagMap;
|
||||
});
|
||||
|
||||
/* Passthroughs */
|
||||
eleventyConfig.addPassthroughCopy({"css": "assets/css"});
|
||||
|
||||
/* Plugins */
|
||||
/* All filters from _config/filters.js */
|
||||
eleventyConfig.addPlugin(pluginFilters);
|
||||
|
||||
/* RSS */
|
||||
eleventyConfig.addPlugin(feedPlugin, {
|
||||
type: "atom", // or "rss", "json"
|
||||
@ -43,7 +69,7 @@ export default async function(eleventyConfig) {
|
||||
formats: ["auto"],
|
||||
|
||||
// output image widths
|
||||
widths: [800],
|
||||
widths: [1000],
|
||||
|
||||
// optional, attributes assigned on <img> nodes override these values
|
||||
htmlOptions: {
|
||||
|
||||
Reference in New Issue
Block a user