Archived
2
0
This repository has been archived on 2025-07-16. You can view files and clone it, but cannot push or open issues or pull requests.
cc24-hub/.eleventy.js
overcuriousity 64d5e75045 progress
2025-07-13 22:18:53 +02:00

77 lines
2.2 KiB
JavaScript

// File: ./eleventy.js
const yaml = require('js-yaml');
const fs = require('fs');
module.exports = function(eleventyConfig) {
// Copy static assets
eleventyConfig.addPassthroughCopy("src/js");
eleventyConfig.addPassthroughCopy("src/images");
eleventyConfig.addPassthroughCopy("src/icons");
eleventyConfig.addPassthroughCopy("src/css");
// Watch for changes
eleventyConfig.addWatchTarget("src/css/");
eleventyConfig.addWatchTarget("src/js/");
eleventyConfig.addWatchTarget("src/data/");
// Custom YAML data loader
eleventyConfig.addDataExtension("yaml", contents => yaml.load(contents));
eleventyConfig.addDataExtension("yml", contents => yaml.load(contents));
// Filters
eleventyConfig.addFilter("filterByDomain", function(tools, domain) {
if (!domain) return tools;
return tools.filter(tool => tool.domains && tool.domains.includes(domain));
});
eleventyConfig.addFilter("filterByPhase", function(tools, phase) {
if (!phase) return tools;
return tools.filter(tool => tool.phases && tool.phases.includes(phase));
});
eleventyConfig.addFilter("filterByType", function(tools, type) {
if (!type) return tools;
return tools.filter(tool => tool.type === type);
});
eleventyConfig.addFilter("searchTools", function(tools, searchTerm) {
if (!searchTerm) return tools;
const term = searchTerm.toLowerCase();
return tools.filter(tool =>
tool.name.toLowerCase().includes(term) ||
tool.description.toLowerCase().includes(term) ||
(tool.tags && tool.tags.some(tag => tag.toLowerCase().includes(term)))
);
});
// Global data
eleventyConfig.addGlobalData("domains", [
'Filesystem Forensics',
'Network Forensics',
'Memory Forensics',
'Live Forensics',
'Malware Analysis',
'Cryptocurrency'
]);
eleventyConfig.addGlobalData("phases", [
'Data Collection',
'Examination',
'Analysis',
'Reporting'
]);
// Configuration
return {
dir: {
input: "src",
output: "_site",
includes: "_includes",
layouts: "_layouts",
data: "data"
},
templateFormats: ["md", "njk", "html"],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk"
};
};