Added dedicated virtual template for releases.
This commit is contained in:
parent
c2c676ce19
commit
05fd995edd
7 changed files with 70 additions and 35 deletions
|
|
@ -7,6 +7,7 @@ import 'dotenv/config';
|
||||||
let allPlugins = [];
|
let allPlugins = [];
|
||||||
const isProd = process.env.ELEVENTY_ENV === "production";
|
const isProd = process.env.ELEVENTY_ENV === "production";
|
||||||
const pathPrefix = isProd ? "/neoBeta/" : "/";
|
const pathPrefix = isProd ? "/neoBeta/" : "/";
|
||||||
|
const buildTime = new Date(Date.now()).toISOString();
|
||||||
|
|
||||||
export default function (eleventyConfig) {
|
export default function (eleventyConfig) {
|
||||||
eleventyConfig.addNunjucksAsyncFilter("githubReleases", async function(owner, repo, callback) {
|
eleventyConfig.addNunjucksAsyncFilter("githubReleases", async function(owner, repo, callback) {
|
||||||
|
|
@ -32,7 +33,6 @@ export default function (eleventyConfig) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
eleventyConfig.setInputDirectory("src");
|
eleventyConfig.setInputDirectory("src");
|
||||||
eleventyConfig.setOutputDirectory("public");
|
eleventyConfig.setOutputDirectory("public");
|
||||||
eleventyConfig.addPassthroughCopy("src/projects/**/*.png");
|
eleventyConfig.addPassthroughCopy("src/projects/**/*.png");
|
||||||
|
|
@ -43,13 +43,14 @@ export default function (eleventyConfig) {
|
||||||
eleventyConfig.addPassthroughCopy("src/authors/**/*.jpeg");
|
eleventyConfig.addPassthroughCopy("src/authors/**/*.jpeg");
|
||||||
eleventyConfig.addPassthroughCopy("src/assets");
|
eleventyConfig.addPassthroughCopy("src/assets");
|
||||||
eleventyConfig.addPassthroughCopy({ "src/favicon/*" : "/" });
|
eleventyConfig.addPassthroughCopy({ "src/favicon/*" : "/" });
|
||||||
|
eleventyConfig.addGlobalData("pathPrefix", pathPrefix);
|
||||||
|
eleventyConfig.addGlobalData("buildTime", buildTime);
|
||||||
|
|
||||||
eleventyConfig.addCollection("projects", function(collection) {
|
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", {
|
eleventyConfig.addGlobalData("eleventyComputed", {
|
||||||
projectData: (data) => {
|
projectData: (data) => {
|
||||||
const inputPath = data.page.inputPath;
|
const inputPath = data.page.inputPath;
|
||||||
|
|
|
||||||
|
|
@ -14,32 +14,13 @@ styles: ["project"]
|
||||||
</div>
|
</div>
|
||||||
<p id="projectSubtitle">{{ subtitle }}</p>
|
<p id="projectSubtitle">{{ subtitle }}</p>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
{% if links or docs or images or releaseType %}
|
{% if links or docs or images or releaseType %}
|
||||||
<div id="projectImagesAndInfo">
|
<div id="projectImagesAndInfo">
|
||||||
{% include "project_image.njk" %}
|
{% include "project_image.njk" %}
|
||||||
<div id="projectInfo">
|
<div id="projectInfo">
|
||||||
<p>Here's what we found about this project:</p>
|
<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 %}
|
{% if links %}
|
||||||
<p>{{ links | length }} links.</p>
|
<p>{{ links | length }} links.</p>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
||||||
29
src/_virtual/releases.njk
Normal file
29
src/_virtual/releases.njk
Normal 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 %}
|
||||||
|
|
@ -70,6 +70,8 @@ code {
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, select {
|
input, select {
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,38 @@ neoBeta is an open-source content management system. There are various ways you
|
||||||
|
|
||||||
### Optional metadata fields
|
### Optional metadata fields
|
||||||
Please fill as many fields as possible.
|
Please fill as many fields as possible.
|
||||||
- *downloadLink* - link for when you click the download link.
|
|
||||||
- *images* - lists of image files names or URLs that will appear in the project page.
|
- *images* - lists of image files names or URLs that will appear in the project page.
|
||||||
- *logo* - your logo file name or URL.
|
- *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
|
### Config file example
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"name": "Ghosts 'n Stuff",
|
"name": "Ghosts 'n Stuff",
|
||||||
"subtitle": "Miscellaneous additions to your server.",
|
"subtitle": "Miscellaneous additions to your Minecraft server.",
|
||||||
"author": "tenkuma",
|
"author": "tenkuma",
|
||||||
"downloadLink": "https://example.com",
|
"downloadLink": "https://modrinth.com/plugin/ghosts/versions",
|
||||||
"images": "["image1.png", "image2.png", "image3.png"]",
|
"images": ["anti-spam.png", "rainbow-chat.png", "skibidi-blocker.png"],
|
||||||
"logo": "logo.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/"
|
||||||
}
|
}
|
||||||
```
|
}```
|
||||||
|
|
@ -11,6 +11,9 @@
|
||||||
"Disroot Git": "https://git.disroot.org/adrianvictor/ghostsandstuff"
|
"Disroot Git": "https://git.disroot.org/adrianvictor/ghostsandstuff"
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
"Installation" : "docs/example_documentation"
|
"Installation" : "docs/installation"
|
||||||
}
|
},
|
||||||
|
"releaseType": "github",
|
||||||
|
"githubRepoOwner": "adrianvic",
|
||||||
|
"githubRepoName": "ghostsandstuff"
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue