Added dedicated virtual template for releases.

This commit is contained in:
天クマ 2025-10-29 20:40:26 -03:00
commit 05fd995edd
7 changed files with 70 additions and 35 deletions

View file

@ -14,32 +14,13 @@ styles: ["project"]
</div>
<p id="projectSubtitle">{{ subtitle }}</p>
</div>
<a id="downloadLink" href="{{ downloadLink | url}}"><button id="downloadButton">{% if downloadLink %}Download{% else %}Unavailable{% endif %}</button></a>
<a id="downloadLink" href="releases"><button id="downloadButton">{% if downloadLink %}Download{% else %}Unavailable{% endif %}</button></a>
</div>
{% if links or docs or images or releaseType %}
<div id="projectImagesAndInfo">
{% include "project_image.njk" %}
<div id="projectInfo">
<p>Here's what we found about this project:</p>
{% if releaseType %}
<p id="projectInfoReleases">
{% if releaseType == "github" %}
{% set releases = githubRepoOwner | githubReleases(githubRepoName) %}
Releases fetched from GitHub:<br>
<div class="projectInfoGitHubReleases less">
{% for release in releases %}
<a href="{{ release.html_url }}">{{ release.name }}</a>
{% endfor %}
</div>
{% endif %}
{% if releaseType == "local" %}
<p class="rainbowText">{{ releases | length }} releases.</p>
{% for label, addr in releases %}
<a href="{{ addr | url }}">{{ label }}</a>
{% endfor %}
{% endif %}
</p>
{% endif %}
{% if links %}
<p>{{ links | length }} links.</p>
<ul>

29
src/_virtual/releases.njk Normal file
View file

@ -0,0 +1,29 @@
---
pagination:
data: collections.projects
size: 1
alias: project
permalink: "{{ project.url }}releases.html"
layout: base.njk
---
<h1>Releases for {{ project.data.name }}</h1>
{% if project.data.releaseType %}
<p id="projectInfoReleases">
{% if project.data.releaseType == "github" %}
{% set releases = project.data.githubRepoOwner | githubReleases(project.data.githubRepoName) %}
Releases fetched from GitHub at {{ buildTime }}:<br>
{% for release in releases %}
<p><a href="{{ release.html_url }}">{{ release.name }}</a></p>
{% endfor %}
{% endif %}
{% if project.data.releaseType == "local" %}
<p class="rainbowText">{{ project.data.releases | length }} releases.</p>
{% for label, addr in project.data.releases %}
<p><a href="{{ addr | url }}">{{ label }}</a></p>
{% endfor %}
{% endif %}
</p>
{% else %}
<p>Could not find any release for this project...</p>
{% endif %}

View file

@ -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 {

View file

@ -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"]
}
```
"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/"
}
}```

View file

@ -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"
}