From 05fd995eddf7947407c17502bc1810ab07cf4da1 Mon Sep 17 00:00:00 2001 From: tenkuma Date: Wed, 29 Oct 2025 20:40:26 -0300 Subject: [PATCH] Added dedicated virtual template for releases. --- eleventy.config.js | 11 +++--- src/_includes/project.njk | 21 +---------- src/_virtual/releases.njk | 29 +++++++++++++++ src/assets/stylesheets/styles.css | 2 ++ src/contribute.md | 35 ++++++++++++++----- ...ample_documentation.md => installation.md} | 0 src/projects/ghostsandstuff/index.json | 7 ++-- 7 files changed, 70 insertions(+), 35 deletions(-) create mode 100644 src/_virtual/releases.njk rename src/projects/ghostsandstuff/docs/{example_documentation.md => installation.md} (100%) diff --git a/eleventy.config.js b/eleventy.config.js index 2b1ad2b..900d4a7 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -7,6 +7,7 @@ import 'dotenv/config'; let allPlugins = []; const isProd = process.env.ELEVENTY_ENV === "production"; const pathPrefix = isProd ? "/neoBeta/" : "/"; +const buildTime = new Date(Date.now()).toISOString(); export default function (eleventyConfig) { eleventyConfig.addNunjucksAsyncFilter("githubReleases", async function(owner, repo, callback) { @@ -31,8 +32,7 @@ export default function (eleventyConfig) { callback(null, []); } }); - - + eleventyConfig.setInputDirectory("src"); eleventyConfig.setOutputDirectory("public"); eleventyConfig.addPassthroughCopy("src/projects/**/*.png"); @@ -43,13 +43,14 @@ export default function (eleventyConfig) { eleventyConfig.addPassthroughCopy("src/authors/**/*.jpeg"); eleventyConfig.addPassthroughCopy("src/assets"); eleventyConfig.addPassthroughCopy({ "src/favicon/*" : "/" }); + eleventyConfig.addGlobalData("pathPrefix", pathPrefix); + eleventyConfig.addGlobalData("buildTime", buildTime); eleventyConfig.addCollection("projects", function(collection) { - return collection.getFilteredByGlob("src/projects/*/*.md"); + const col = collection.getFilteredByGlob("src/projects/*/*.md"); + return col; }); - eleventyConfig.addGlobalData("pathPrefix", pathPrefix) - eleventyConfig.addGlobalData("eleventyComputed", { projectData: (data) => { const inputPath = data.page.inputPath; diff --git a/src/_includes/project.njk b/src/_includes/project.njk index e2ee03a..535d3c3 100644 --- a/src/_includes/project.njk +++ b/src/_includes/project.njk @@ -14,32 +14,13 @@ styles: ["project"]

{{ subtitle }}

- + {% if links or docs or images or releaseType %}
{% include "project_image.njk" %}

Here's what we found about this project:

- {% if releaseType %} -

- {% if releaseType == "github" %} - {% set releases = githubRepoOwner | githubReleases(githubRepoName) %} - Releases fetched from GitHub:
-

- {% for release in releases %} - {{ release.name }} - {% endfor %} -
- {% endif %} - {% if releaseType == "local" %} -

{{ releases | length }} releases.

- {% for label, addr in releases %} - {{ label }} - {% endfor %} - {% endif %} -

- {% endif %} {% if links %}

{{ links | length }} links.

    diff --git a/src/_virtual/releases.njk b/src/_virtual/releases.njk new file mode 100644 index 0000000..37d475b --- /dev/null +++ b/src/_virtual/releases.njk @@ -0,0 +1,29 @@ +--- +pagination: + data: collections.projects + size: 1 + alias: project +permalink: "{{ project.url }}releases.html" +layout: base.njk +--- +

    Releases for {{ project.data.name }}

    + +{% if project.data.releaseType %} +

    + {% if project.data.releaseType == "github" %} + {% set releases = project.data.githubRepoOwner | githubReleases(project.data.githubRepoName) %} + Releases fetched from GitHub at {{ buildTime }}:
    + {% for release in releases %} +

    {{ release.name }}

    + {% endfor %} + {% endif %} + {% if project.data.releaseType == "local" %} +

    {{ project.data.releases | length }} releases.

    + {% for label, addr in project.data.releases %} +

    {{ label }}

    + {% endfor %} + {% endif %} +

    +{% else %} +

    Could not find any release for this project...

    +{% endif %} diff --git a/src/assets/stylesheets/styles.css b/src/assets/stylesheets/styles.css index e743958..98f38bf 100644 --- a/src/assets/stylesheets/styles.css +++ b/src/assets/stylesheets/styles.css @@ -70,6 +70,8 @@ code { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; border-radius: 2px; display: inline-block; + max-width: 100%; + overflow-x: auto; } input, select { diff --git a/src/contribute.md b/src/contribute.md index 02b96d7..c936590 100644 --- a/src/contribute.md +++ b/src/contribute.md @@ -15,20 +15,39 @@ neoBeta is an open-source content management system. There are various ways you - *tags* - whether your project is a plugin or mod. ### Optional metadata fields -Please fill as many fields as possible. - - *downloadLink* - link for when you click the download link. +Please fill as many fields as possible. - *images* - lists of image files names or URLs that will appear in the project page. - *logo* - your logo file name or URL. +### Releases metadata + - *releasesType* - wheter your project uses `local` releases or `github`. +For local releases: + - *releases* - a list of relases labels and links. +For GitHub releases: + - *githubRepoOwner* - username of the repo owner. + - *githubReponame* - name of the repository. + ### Config file example ``` { "name": "Ghosts 'n Stuff", - "subtitle": "Miscellaneous additions to your server.", + "subtitle": "Miscellaneous additions to your Minecraft server.", "author": "tenkuma", - "downloadLink": "https://example.com", - "images": "["image1.png", "image2.png", "image3.png"]", + "downloadLink": "https://modrinth.com/plugin/ghosts/versions", + "images": ["anti-spam.png", "rainbow-chat.png", "skibidi-blocker.png"], "logo": "logo.png", - "tags": ["plugin", "mod"] -} -``` \ No newline at end of file + "tags": ["plugin"], + "links": { + "GitHub": "https://github.com/adrianvic/ghostsandstuff", + "Disroot Git": "https://git.disroot.org/adrianvictor/ghostsandstuff" + }, + "docs": { + "Installation" : "docs/installation" + }, + "releaseType": "github or local", + "githubRepoOwner": "adrianvic", + "githubRepoName": "ghostsandstuff", + "releases": { + "test release": "https://example.com/" + } +}``` \ No newline at end of file diff --git a/src/projects/ghostsandstuff/docs/example_documentation.md b/src/projects/ghostsandstuff/docs/installation.md similarity index 100% rename from src/projects/ghostsandstuff/docs/example_documentation.md rename to src/projects/ghostsandstuff/docs/installation.md diff --git a/src/projects/ghostsandstuff/index.json b/src/projects/ghostsandstuff/index.json index 24aee96..c81edea 100644 --- a/src/projects/ghostsandstuff/index.json +++ b/src/projects/ghostsandstuff/index.json @@ -11,6 +11,9 @@ "Disroot Git": "https://git.disroot.org/adrianvictor/ghostsandstuff" }, "docs": { - "Installation" : "docs/example_documentation" - } + "Installation" : "docs/installation" + }, + "releaseType": "github", + "githubRepoOwner": "adrianvic", + "githubRepoName": "ghostsandstuff" } \ No newline at end of file