Moving to Eleventy. Search not working yet.

This commit is contained in:
天クマ 2025-10-24 20:42:54 -03:00
commit 26db9488db
22 changed files with 1852 additions and 190 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
node_modules
_site

View file

@ -1 +1 @@
Adrian Victor de A. A. <adrianvictor@disroot.org>
Adrian Victor de A. A. <adrianvictor@disroot.org>

50
LICENSE
View file

@ -1,25 +1,25 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org/>
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org/>

19
_includes/base.njk Normal file
View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/assets/styles.css" media="screen">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="project.js"></script>
<script src="featured.js" defer></script>
<title>neoBeta</title>
</head>
<body>
<div id="everythingHelper">
{% include "header.njk" %}
<main>
{{ content | safe }}
</main>
</div>
</body>
</html>

11
_includes/header.njk Normal file
View file

@ -0,0 +1,11 @@
<header>
<div id="linksBox">
<h1 id="title">neoBeta</h1>
<ul id="headerLinks">
<a href="/index.html">home</a> -
<a href="/index.html">mods</a> -
<a href="/index.html">plugins</a>
</ul>
<p id="credits">Adrian Victor, 2025 (<a href="https://git.disroot.org/adrianvictor/neoBeta">Unlicense</a>)</p>
</div>
</header>

29
_includes/project.njk Normal file
View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="/assets/styles.css" media="screen">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>neoBeta</title>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
</head>
<body>
<div id="everythingHelper">
{% include "header.njk" %}
<div id="projectHeader">
<img src="{{ page.dir }}{{ logoName }}.{{ logoExtension }}">
<div id="projectTitleSubtitle">
<div id="projectTitleAuthor">
<h1 id="projectTitle">{{ projectName }}</h1>
<p id="projectAuthor">by {{ projectAuthor }}</p>
</div>
<p id="projectSubtitle">{{ projectSubtitle }}</p>
</div>
<a id="downloadLink" href="{{ projectDonwloadLink }}"><button id="downloadButton">Download</button></a>
</div>
<main id="projectDescription">
{{ content | safe }}
</main>
</div>
</body>
</html>

View file

@ -1,30 +1,30 @@
const featuredHelper = document.querySelector("#featuredHelper");
async function getFeaturedJSON() {
const response = await fetch(`featured.json`);
if (!response.ok) {
featuredHelper.innerHTML = `
<p>;( Oopsie! Could not load featured projects...</p>
`
throw new Error("Failed to fetch featured projects JSON");
}
const data = await response.json();
data.forEach(project => {
const featuredDiv = document.createElement("div");
featuredDiv.classList.add("featuredProject");
featuredDiv.id = `featured-${project}`;
featuredDiv.innerHTML = `
<a href="project.html?id=${project}">
<img src="projects/${project}/logo.png">
<p>:${project}</p>
</a>
`;
featuredHelper.appendChild(featuredDiv);
loadProject(project, document.querySelector(`featured-${project} p`), undefined, undefined, undefined, document.querySelector(`featured-${project} img`))
});
}
const featuredHelper = document.querySelector("#featuredHelper");
async function getFeaturedJSON() {
const response = await fetch(`featured.json`);
if (!response.ok) {
featuredHelper.innerHTML = `
<p>;( Oopsie! Could not load featured projects...</p>
`
throw new Error("Failed to fetch featured projects JSON");
}
const data = await response.json();
data.forEach(project => {
const featuredDiv = document.createElement("div");
featuredDiv.classList.add("featuredProject");
featuredDiv.id = `featured-${project}`;
featuredDiv.innerHTML = `
<a href="project.html?id=${project}">
<img src="projects/${project}/logo.png">
<p>:${project}</p>
</a>
`;
featuredHelper.appendChild(featuredDiv);
loadProject(project, document.querySelector(`featured-${project} p`), undefined, undefined, undefined, document.querySelector(`featured-${project} img`))
});
}
getFeaturedJSON();

View file

@ -1,11 +1,11 @@
const featuredHelper = document.querySelector("#featuredHelper")
async function loadFeatured() {
const response = await fetch(`bananas.json`);
if (!response.ok) {
featuredHelper.innerHTML = `
<p>Oops! Failed to fetch featured projects...</p>
`
throw new Error("Failed to fetch featured projects JSON");
}
const featuredHelper = document.querySelector("#featuredHelper")
async function loadFeatured() {
const response = await fetch(`bananas.json`);
if (!response.ok) {
featuredHelper.innerHTML = `
<p>Oops! Failed to fetch featured projects...</p>
`
throw new Error("Failed to fetch featured projects JSON");
}
}

41
eleventy.config.js Normal file
View file

@ -0,0 +1,41 @@
import lunr from 'lunr';
import fs from 'fs';
let allPlugins = [];
let lunrIndex = null;
export default function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("projects/**/*.png");
eleventyConfig.addPassthroughCopy("projects/**/*.jpg");
eleventyConfig.addPassthroughCopy("projects/**/*.jpeg");
eleventyConfig.addPassthroughCopy("assets");
eleventyConfig.addCollection('searchIndex', (collectionApi) => {
const result = collectionApi.getFilteredByTag("plugin").map(item => {
return {
title: item.data.projectName,
subtitle: item.data.projectSubtitle || "",
url: item.url
};
});
console.log("Collected " + result.length + " plugins for search index.");
console.log(result);
return result;
});
eleventyConfig.on('afterBuild', async (eleventyConfig) => {
lunrIndex = lunr(function () {
this.ref('url');
this.field('title');
this.field('subtitle');
allPlugins.forEach(function (doc) {
this.add(doc);
}, this);
});
const indexJson = lunrIndex.toJSON();
fs.writeFileSync('./_site/search_index.json', JSON.stringify(indexJson));
});
};

View file

@ -1,53 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css" media="screen">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="project.js"></script>
<script src="featured.js" defer></script>
<title>neoBeta</title>
</head>
<body>
<div id="everythingHelper">
<header>
<div id="linksBox">
<h1 id="title">neoBeta</h1>
<ul id="headerLinks">
<a href="index.html">home</a> -
<a href="index.html">mods</a> -
<a href="index.html">plugins</a>
</ul>
<p id="credits">Adrian Victor, 2025 (<a href="https://git.disroot.org/adrianvictor/neoBeta">Unlicense</a>)</p>
</div>
</header>
<main>
<h1>Welcome.</h1>
<p>This is a project that aims to preserve Minecraft Beta mods and plugins through archives of documentation and JARs and showcase new plugins for beta.</p>
<div id="featured"><h2>featured projects</h2>
<div id="featuredHelper">
<!-- <div class="featuredProject">
<a href="project.html?id=aboukkit">
<img src="images/projects/aboukkit.png">
<p>Aboukkit</p>
<p>by tenkuma</p>
</a>
</div>
---
layout: "base.njk"
---
<div class="featuredProject">
<img src="images/projects/ghostsandstuff.png">
<p>Ghosts 'n Stuff</p>
<p>by tenkuma</p>
</div>
<div class="featuredProject">
<img src="images/projects/hats.png">
<p>Hats</p>
<p>by AleksandarHaralanov</p>
</div> -->
</div>
</div>
</main>
<h1>Welcome.</h1>
<p>This is a project that aims to preserve Minecraft Beta mods and plugins through archives of documentation and JARs and showcase new plugins for beta.</p>
<div id="featured"><h2>featured projects</h2>
<div id="featuredHelper">
<!-- <div class="featuredProject">
<a href="project.html?id=aboukkit">
<img src="images/projects/aboukkit.png">
<p>Aboukkit</p>
<p>by tenkuma</p>
</a>
</div>
<div class="featuredProject">
<img src="images/projects/ghostsandstuff.png">
<p>Ghosts 'n Stuff</p>
<p>by tenkuma</p>
</div>
<div class="featuredProject">
<img src="images/projects/hats.png">
<p>Hats</p>
<p>by AleksandarHaralanov</p>
</div> -->
</div>
</body>
</html>
</div>

1575
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

25
package.json Normal file
View file

@ -0,0 +1,25 @@
{
"name": "neobeta",
"version": "1.0.0",
"description": "A CMS for minecraft plugins.",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"serve": "npx @11ty/eleventy --serve"
},
"repository": {
"type": "git",
"url": "git+https://github.com/adrianvic/neoBeta.git"
},
"author": "Adrian Victor de Abreu Alves <adrianvictor@disroot.org>",
"license": "Unlicense",
"bugs": {
"url": "https://github.com/adrianvic/neoBeta/issues"
},
"homepage": "https://github.com/adrianvic/neoBeta#readme",
"dependencies": {
"@11ty/eleventy": "^3.1.2",
"lunr": "^2.3.9"
}
}

View file

@ -1,51 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css" media="screen">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>neoBeta</title>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<!-- <script src="MinecraftColorCodes.3.7.js"></script> -->
<script src="project.js"></script>
</head>
<body>
<div id="everythingHelper">
<header>
<div id="linksBox">
<h1 id="title">neoBeta</h1>
<ul id="headerLinks">
<a href="index.html">home</a> -
<a href="index.html">mods</a> -
<a href="index.html">plugins</a>
</ul>
<p id="credits">Adrian Victor, 2025 (<a href="https://git.disroot.org/adrianvictor/neoBeta">Unlicense</a>)</p>
</div>
</header>
<div id="projectHeader">
<img>
<div id="projectTitleSubtitle">
<div id="projectTitleAuthor">
<h1 id="projectTitle">Loading project...</h1>
<p id="projectAuthor">by tenkuma</p>
</div>
<p id="projectSubtitle">...</p>
</div>
<a id="downloadLink"><button id="downloadButton">Download</button></a>
</div>
<main id="projectDescription">
</main>
</div>
<script>
const downloadButton = document.querySelector("#downloadLink");
const header = document.querySelector("#projectHeader");
const headerTitle = document.querySelector("#projectTitle");
const subtitle = document.querySelector("#projectSubtitle");
const author = document.querySelector("#projectAuthor");
const logo = document.querySelector("#projectHeader img");
const main = document.querySelector("main");
const body = document.querySelector("body");
loadProject(projectID, headerTitle, subtitle, author, main, logo, downloadButton, body, body);
</script>
</body>
</html>

View file

@ -1,3 +1,15 @@
---
layout: "project.njk"
projectName: "Aboukkit"
projectSubtitle: "Adds a simple way to add custom commands with custom responses to your server."
projectAuthor: "tenkuma"
projectDownloadLink: "https://modrinth.com/plugin/aboukkit/versions"
backgroundImageSize: "cover"
logoName: "logo"
logoExtension: "png"
tags: plugin
---
![Aboukkit logo, abboukit written in a Minecraft's logo like font painted in red.](https://cdn.modrinth.com/data/cached_images/94b1f813f8e15f82dddcffa5284c92e59cb93b27.png)
This plugin adds a simple way to add custom commands that will respond users with predefined messages from ```config.yml```. It supports Minecraft's color coding (use & instead of §) ~~and placeholders for player/server info~~ (TODO).

View file

@ -1,11 +0,0 @@
{
"project": {
"author": "tenkuma",
"title": "Aboukkit",
"subtitle": "Adds a simple way to add custom commands with custom responses to your server.",
"downloadLink": "https://modrinth.com/plugin/aboukkit/versions",
"backgroundColor": "darkred",
"displayLogo": true
}
}

View file

Before

Width:  |  Height:  |  Size: 480 KiB

After

Width:  |  Height:  |  Size: 480 KiB

Before After
Before After

View file

@ -1,3 +1,15 @@
---
layout: "project.njk"
projectName: "Ghosts 'n Stuff"
projectSubtitle: "Adds a simple way to add custom commands with custom responses to your server."
projectAuthor: "tenkuma"
projectDownloadLink: "https://modrinth.com/plugin/ghosts/versions"
backgroundImageSize: "cover"
logoName: "logo"
logoExtension: "png"
tags: "plugin"
---
This plugins aims to use stuff from my library that would not fit into any plugin (or not in the way presented here) that has ~~a lot~~ (WIP) of random stuff. Everything should be togglable in the config.
## Features

View file

@ -1,12 +0,0 @@
{
"project": {
"author": "tenkuma",
"title": "Ghosts 'n Stuff",
"downloadLink": "https://modrinth.com/plugin/ghosts/versions",
"subtitle": "Adds a simple way to add custom commands with custom responses to your server.",
"backgroundImage": "projects/ghostsandstuff/ghosts.jpg",
"backgroundImageSize": "cover",
"displayLogo": true
}
}

36
search.html Normal file
View file

@ -0,0 +1,36 @@
---
layout: "base.njk"
---
<input type="text" id="search" placeholder="Search..." />
<ul id="results"></ul>
<script src="https://unpkg.com/lunr/lunr.js"></script>
<script>
fetch('search.json')
.then(response => response.json())
.then(data => {
const idx = lunr.Index.load(data.index);
const documents = data.documents;
const searchInput = document.getElementById('search');
searchInput.addEventListener('input', function () {
const query = this.value;
let results = [];
// Perform search
if (query.length > 0) {
results = idx.search(query).map(result => {
const document = documents.find(doc => doc.id === result.ref);
return `<li><a href="${document.url}">${document.title}</a></li>`;
});
// Display results
document.getElementById('results').innerHTML = results.join('');
} else {
document.getElementById('results').innerHTML = '';
}
});
});
</script>