forked from nyancrimew/maia.crimew.gay
start implementing related posts system
This commit is contained in:
parent
f0d68c06fe
commit
f1b1848d88
6 changed files with 139 additions and 3 deletions
29
.eleventy.js
29
.eleventy.js
|
@ -3,6 +3,7 @@ const pluginRss = require('@11ty/eleventy-plugin-rss');
|
||||||
const timeToRead = require('eleventy-plugin-time-to-read');
|
const timeToRead = require('eleventy-plugin-time-to-read');
|
||||||
const safeLinks = require('@sardine/eleventy-plugin-external-links');
|
const safeLinks = require('@sardine/eleventy-plugin-external-links');
|
||||||
const eleventySass = require("@11tyrocks/eleventy-plugin-sass-lightningcss");
|
const eleventySass = require("@11tyrocks/eleventy-plugin-sass-lightningcss");
|
||||||
|
const related = require("eleventy-plugin-related");
|
||||||
|
|
||||||
module.exports = function (eleventyConfig) {
|
module.exports = function (eleventyConfig) {
|
||||||
const parseDate = (str) => {
|
const parseDate = (str) => {
|
||||||
|
@ -45,11 +46,35 @@ module.exports = function (eleventyConfig) {
|
||||||
|
|
||||||
eleventyConfig.addFilter('urlescape', str => {
|
eleventyConfig.addFilter('urlescape', str => {
|
||||||
return str.split('/').map(part => encodeURI(part)).join('/')
|
return str.split('/').map(part => encodeURI(part)).join('/')
|
||||||
})
|
});
|
||||||
|
|
||||||
|
// this appears to potentially be dependent on rendering order
|
||||||
|
eleventyConfig.addFilter("related", function(obj) {
|
||||||
|
const post = this.ctx;
|
||||||
|
const posts = this.ctx.collections.posts.map(post => post.data);
|
||||||
|
|
||||||
|
const tagScore = (a, b) => {
|
||||||
|
const total = a.tags.length + b.tags.length;
|
||||||
|
const intersection = a.tags.filter(tag => b.tags.includes(tag)).length;
|
||||||
|
return (intersection * 2) / total;
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = related.related({
|
||||||
|
serializer: (doc) => [doc.title, doc.description],
|
||||||
|
weights: [10, 10],
|
||||||
|
})(post, posts).map(result => {
|
||||||
|
return {
|
||||||
|
relative: result.relative + tagScore(post, result.document),
|
||||||
|
document: result.document
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return results.filter(result => result.relative > 0.0).slice(0,3);
|
||||||
|
});
|
||||||
|
|
||||||
eleventyConfig.addCollection('posts', collection => {
|
eleventyConfig.addCollection('posts', collection => {
|
||||||
return collection.getFilteredByGlob('src/posts/*.md').reverse()
|
return collection.getFilteredByGlob('src/posts/*.md').reverse()
|
||||||
})
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
templateFormats: ["njk", "md", "html"],
|
templateFormats: ["njk", "md", "html"],
|
||||||
|
|
108
package-lock.json
generated
108
package-lock.json
generated
|
@ -13,6 +13,7 @@
|
||||||
"@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
|
"@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
|
||||||
"@11tyrocks/eleventy-plugin-sass-lightningcss": "^1.0.3",
|
"@11tyrocks/eleventy-plugin-sass-lightningcss": "^1.0.3",
|
||||||
"@sardine/eleventy-plugin-external-links": "^1.4.0",
|
"@sardine/eleventy-plugin-external-links": "^1.4.0",
|
||||||
|
"eleventy-plugin-related": "^1.0.6",
|
||||||
"eleventy-plugin-time-to-read": "^1.3.0"
|
"eleventy-plugin-time-to-read": "^1.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -424,6 +425,15 @@
|
||||||
"node": ">=0.4.0"
|
"node": ">=0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/afinn-165": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/afinn-165/-/afinn-165-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-7+Wlx3BImrK0HiG6y3lU4xX7SpBPSSu8T9iguPMlaueRFxjbYwAQrp9lqZUuFikqKbd/en8lVREILvP2J80uJA==",
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/wooorm"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ansi-styles": {
|
"node_modules/ansi-styles": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
@ -455,6 +465,17 @@
|
||||||
"node": ">= 8"
|
"node": ">= 8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/apparatus": {
|
||||||
|
"version": "0.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/apparatus/-/apparatus-0.0.10.tgz",
|
||||||
|
"integrity": "sha512-KLy/ugo33KZA7nugtQ7O0E1c8kQ52N3IvD/XgIh4w/Nr28ypfkwDfA67F1ev4N1m5D+BOk1+b2dEJDfpj/VvZg==",
|
||||||
|
"dependencies": {
|
||||||
|
"sylvester": ">= 0.0.8"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.2.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/argparse": {
|
"node_modules/argparse": {
|
||||||
"version": "1.0.10",
|
"version": "1.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||||
|
@ -910,6 +931,24 @@
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.401.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.401.tgz",
|
||||||
"integrity": "sha512-AswqHsYyEbfSn0x87n31Na/xttUqEAg7NUjpiyxC20MaWKLyadOYHMzyLdF78N1iw+FK8/2KHLpZxRdyRILgtA=="
|
"integrity": "sha512-AswqHsYyEbfSn0x87n31Na/xttUqEAg7NUjpiyxC20MaWKLyadOYHMzyLdF78N1iw+FK8/2KHLpZxRdyRILgtA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/eleventy-plugin-related": {
|
||||||
|
"version": "1.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/eleventy-plugin-related/-/eleventy-plugin-related-1.0.6.tgz",
|
||||||
|
"integrity": "sha512-Kg4OrXO8eGZkVA5zdhKKYVjnSEFy7CZIsiJGsGJ6ciC0G8cRxk5oIWxMnMVk5i2k99qN2gsEnA5p18zAr2AenA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/jpoehnelt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/jpoehnelt"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"related-documents": "^1.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/eleventy-plugin-time-to-read": {
|
"node_modules/eleventy-plugin-time-to-read": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/eleventy-plugin-time-to-read/-/eleventy-plugin-time-to-read-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/eleventy-plugin-time-to-read/-/eleventy-plugin-time-to-read-1.3.0.tgz",
|
||||||
|
@ -1733,6 +1772,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/list-to-array/-/list-to-array-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/list-to-array/-/list-to-array-1.1.0.tgz",
|
||||||
"integrity": "sha512-+dAZZ2mM+/m+vY9ezfoueVvrgnHIGi5FvgSymbIgJOFwiznWyA59mav95L+Mc6xPtL3s9gm5eNTlNtxJLbNM1g=="
|
"integrity": "sha512-+dAZZ2mM+/m+vY9ezfoueVvrgnHIGi5FvgSymbIgJOFwiznWyA59mav95L+Mc6xPtL3s9gm5eNTlNtxJLbNM1g=="
|
||||||
},
|
},
|
||||||
|
"node_modules/lodash": {
|
||||||
|
"version": "4.17.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||||
|
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||||
|
},
|
||||||
"node_modules/lodash.deburr": {
|
"node_modules/lodash.deburr": {
|
||||||
"version": "4.1.0",
|
"version": "4.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz",
|
||||||
|
@ -1947,6 +1991,22 @@
|
||||||
"mustache": "bin/mustache"
|
"mustache": "bin/mustache"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/natural": {
|
||||||
|
"version": "5.2.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/natural/-/natural-5.2.4.tgz",
|
||||||
|
"integrity": "sha512-hstvCeNO63go8GMwZIO/wrmcj2oh0Wom2aN7QFF+1I7EJX/NoyM3jWKDbEoCkkQ7CCqqCn0+QdP9Bj2jkD731A==",
|
||||||
|
"dependencies": {
|
||||||
|
"afinn-165": "^1.0.2",
|
||||||
|
"apparatus": "^0.0.10",
|
||||||
|
"safe-stable-stringify": "^2.2.0",
|
||||||
|
"sylvester": "^0.0.12",
|
||||||
|
"underscore": "^1.9.1",
|
||||||
|
"wordnet-db": "^3.1.11"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/neo-async": {
|
"node_modules/neo-async": {
|
||||||
"version": "2.6.2",
|
"version": "2.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
|
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
|
||||||
|
@ -2418,6 +2478,25 @@
|
||||||
"slash": "^1.0.0"
|
"slash": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/related-documents": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/related-documents/-/related-documents-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-NIbJulmApiKxJRSVkXil/TOSYEnnHOmOrG2JtkClva/w+0CV/KqHSlPREyLijayBaT0XNY3htgVc1ubks6VpCw==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/jpoehnelt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/jpoehnelt"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"natural": "^5.1.13"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
"version": "1.22.2",
|
"version": "1.22.2",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz",
|
||||||
|
@ -2476,6 +2555,14 @@
|
||||||
"queue-microtask": "^1.2.2"
|
"queue-microtask": "^1.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/safe-stable-stringify": {
|
||||||
|
"version": "2.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz",
|
||||||
|
"integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/sass": {
|
"node_modules/sass": {
|
||||||
"version": "1.62.1",
|
"version": "1.62.1",
|
||||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.62.1.tgz",
|
"resolved": "https://registry.npmjs.org/sass/-/sass-1.62.1.tgz",
|
||||||
|
@ -2628,6 +2715,14 @@
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sylvester": {
|
||||||
|
"version": "0.0.12",
|
||||||
|
"resolved": "https://registry.npmjs.org/sylvester/-/sylvester-0.0.12.tgz",
|
||||||
|
"integrity": "sha512-SzRP5LQ6Ts2G5NyAa/jg16s8e3R7rfdFjizy1zeoecYWw+nGL+YA1xZvW/+iJmidBGSdLkuvdwTYEyJEb+EiUw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.2.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/to-fast-properties": {
|
"node_modules/to-fast-properties": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||||
|
@ -2674,6 +2769,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/uhyphen/-/uhyphen-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/uhyphen/-/uhyphen-0.2.0.tgz",
|
||||||
"integrity": "sha512-qz3o9CHXmJJPGBdqzab7qAYuW8kQGKNEuoHFYrBwV6hWIMcpAmxDLXojcHfFr9US1Pe6zUswEIJIbLI610fuqA=="
|
"integrity": "sha512-qz3o9CHXmJJPGBdqzab7qAYuW8kQGKNEuoHFYrBwV6hWIMcpAmxDLXojcHfFr9US1Pe6zUswEIJIbLI610fuqA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/underscore": {
|
||||||
|
"version": "1.13.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz",
|
||||||
|
"integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A=="
|
||||||
|
},
|
||||||
"node_modules/unpipe": {
|
"node_modules/unpipe": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||||
|
@ -2747,6 +2847,14 @@
|
||||||
"node": ">= 10.0.0"
|
"node": ">= 10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/wordnet-db": {
|
||||||
|
"version": "3.1.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/wordnet-db/-/wordnet-db-3.1.14.tgz",
|
||||||
|
"integrity": "sha512-zVyFsvE+mq9MCmwXUWHIcpfbrHHClZWZiVOzKSxNJruIcFn2RbY55zkhiAMMxM8zCVSmtNiViq8FsAZSFpMYag==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/wordwrap": {
|
"node_modules/wordwrap": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
|
"@11ty/eleventy-plugin-syntaxhighlight": "^4.0.0",
|
||||||
"@11tyrocks/eleventy-plugin-sass-lightningcss": "^1.0.3",
|
"@11tyrocks/eleventy-plugin-sass-lightningcss": "^1.0.3",
|
||||||
"@sardine/eleventy-plugin-external-links": "^1.4.0",
|
"@sardine/eleventy-plugin-external-links": "^1.4.0",
|
||||||
|
"eleventy-plugin-related": "^1.0.6",
|
||||||
"eleventy-plugin-time-to-read": "^1.3.0"
|
"eleventy-plugin-time-to-read": "^1.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ date: 2023-01-19
|
||||||
changed_date: 2023-01-22
|
changed_date: 2023-01-22
|
||||||
description: "and grab the TSA nofly list along the way"
|
description: "and grab the TSA nofly list along the way"
|
||||||
tags:
|
tags:
|
||||||
|
- leak
|
||||||
- security
|
- security
|
||||||
- infosec
|
- infosec
|
||||||
- jenkins
|
- jenkins
|
||||||
|
|
|
@ -7,7 +7,7 @@ tags:
|
||||||
- infosec
|
- infosec
|
||||||
- malware
|
- malware
|
||||||
- reverse engineering
|
- reverse engineering
|
||||||
- php
|
- analysis
|
||||||
feature_image: /img/posts/nebita-malware/cover.jpg
|
feature_image: /img/posts/nebita-malware/cover.jpg
|
||||||
feature_alt: "a glitchy edited screenshot of the nebita.com home page"
|
feature_alt: "a glitchy edited screenshot of the nebita.com home page"
|
||||||
---
|
---
|
||||||
|
|
|
@ -3,6 +3,7 @@ title: "infosec company owned completely by 4chan user"
|
||||||
date: 2023-05-10
|
date: 2023-05-10
|
||||||
description: "risk visualize deez nuts"
|
description: "risk visualize deez nuts"
|
||||||
tags:
|
tags:
|
||||||
|
- leak
|
||||||
- security
|
- security
|
||||||
- infosec
|
- infosec
|
||||||
- jenkins
|
- jenkins
|
||||||
|
|
Loading…
Reference in a new issue