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 %}Here's what we found about this project:
- {% if releaseType %} -
- {% if releaseType == "github" %}
- {% set releases = githubRepoOwner | githubReleases(githubRepoName) %}
- Releases fetched from GitHub:
-
{{ releases | length }} releases.
- {% for label, addr in releases %} - {{ label }} - {% endfor %} - {% endif %} - - {% endif %} {% if links %}{{ links | length }} links.
+ {% if project.data.releaseType == "github" %}
+ {% set releases = project.data.githubRepoOwner | githubReleases(project.data.githubRepoName) %}
+ Releases fetched from GitHub at {{ buildTime }}:
+ {% for release in releases %}
+
{{ project.data.releases | length }} releases.
+ {% for label, addr in project.data.releases %} + + {% 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