Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically add download links to the releases #56

Merged
merged 5 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 40 additions & 33 deletions eleventy.config.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
const pluginRss = require("@11ty/eleventy-plugin-rss");
const markdownIt = require("markdown-it");

module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/assets");
eleventyConfig.addPassthroughCopy("src/favicon.ico");
eleventyConfig.addPlugin(pluginRss);

eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
});

eleventyConfig.addFilter("md", function (content = "") {
return markdownIt({ html: true }).render(content);
});

eleventyConfig.addFilter("dateIso", date => {
return date.toISOString();
});

eleventyConfig.addFilter("dateReadable", date => {
return date.toDateString();
});

eleventyConfig.addCollection("posts", function(collection) {
return collection.getFilteredByGlob("src/news/*.md");
});

return {
dir: {
input: "src",
output: "dist",
includes: "_layouts"
}
};
}
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("src/assets");
eleventyConfig.addPassthroughCopy("src/favicon.ico");
eleventyConfig.addPlugin(pluginRss);

eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
});

eleventyConfig.addFilter("md", function (content = "") {
return markdownIt({ html: true }).render(content);
});

eleventyConfig.addFilter("dateIso", (date) => {
return date.toISOString();
});

eleventyConfig.addFilter("dateReadable", (date) => {
return date.toDateString();
});

eleventyConfig.addCollection("posts", function (collection) {
return collection.getFilteredByGlob("src/news/*.md");
});

eleventyConfig.addFilter("getLatestVersion", function (collection) {
// Find the latest known version from the collection
return collection?.reduce((latest, item) => {
return !latest || item.data.version > latest ? item.data.version : latest;
}, null);
});

return {
dir: {
input: "src",
output: "dist",
includes: "_layouts",
},
};
};
15 changes: 8 additions & 7 deletions src/_data/site.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"title": "Dangerzone",
"description": "The Dangerzone application takes potentially dangerous documents and converts them to safe PDF files",
"url": "https://dangerzone.rocks/",
"author": {
"name": "Dangerzone development team",
"email": "[email protected]"
}
"title": "Dangerzone",
"description": "The Dangerzone application takes potentially dangerous documents and converts them to safe PDF files",
"url": "https://dangerzone.rocks/",
"author": {
"name": "Dangerzone development team",
"email": "[email protected]"
},
"github_repo": "https://github.com/freedomofpress/dangerzone"
}
55 changes: 55 additions & 0 deletions src/_includes/downloads.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<section id="downloads" class="wrapper clearfix">
<h2>Download Dangerzone {{ version }}</h2>
🔍 <a href="https://github.com/freedomofpress/dangerzone/blob/v{{ version }}/INSTALL.md#verifying-pgp-signatures">How to verify</a>
<div class="os-download-container">
<div class="osPrimary">
<img src="/assets/img/apple-logo.png" alt="Apple Logo">
<p class="title">MacOS</p>
<a class="button"
href="https://github.com/freedomofpress/dangerzone/releases/download/v{{ version }}/Dangerzone-{{ version }}-i686.dmg">Intel chip</a>
<a class="button"
href="https://github.com/freedomofpress/dangerzone/releases/download/v{{ version }}/Dangerzone-{{ version }}-arm64.dmg">Apple Silicon chip</a>
<p class="cpu-arch-info">&#8505;&#65039;
<a href="https://support.apple.com/en-us/HT211814">Which one do I have?</a>
</p>
</div>
<div class="osPrimary">
<img src="/assets/img/windows-logo.png" alt="Windows Logo">
<p class="title">Windows</p>
<a class="button"
href="https://github.com/freedomofpress/dangerzone/releases/download/v{{ version }}/Dangerzone-{{ version }}.msi">Download for
Windows</a>
<p class="cpu-arch-info">&#65039; <!-- invalid emoji to display same-height whitespace as macOS -->
</p>
</div>
</div>
<div class="os-download-container">
<div class="osSecondary">
<img src="/assets/img/ubuntu-logo.png" alt="Ubuntu Logo">
<p class="title">Ubuntu / Debian</p>
<a class="button"
href="https://github.com/freedomofpress/dangerzone/blob/v{{ version }}/INSTALL.md#ubuntu-debian">Install</a>
</div>
<div class="osSecondary">
<img src="/assets/img/fedora-logo.png" alt="Fedora Logo">
<p class="title">Fedora</p>
<a class="button"
href="https://github.com/freedomofpress/dangerzone/blob/v{{ version }}/INSTALL.md#fedora">Install</a>
</div>
<div class="osSecondary">
<img src="/assets/img/tails-logo.svg" alt="Tails Logo">
<p class="title">Tails</p>
<a class="button" href="https://tails.net/doc/persistent_storage/additional_software/dangerzone/index.en.html">Install</a>
</div>
<div class="osSecondary">
<img src="/assets/img/linux-logo.png" alt="Linux Logo">
<p class="title">Other Linux</p>
<a class="button" href="https://github.com/freedomofpress/dangerzone/blob/main/BUILD.md">Build from Source</a>
</div>
<div class="osSecondary">
<img src="/assets/img/qubes-os-logo.png" alt="Qubes OS Logo">
<p class="title">Qubes OS (Beta)</p>
<a class="button" href="https://github.com/freedomofpress/dangerzone/blob/v{{ version }}/INSTALL.md#qubes-os">Install</a>
</div>
</div>
</section>
9 changes: 8 additions & 1 deletion src/_layouts/post.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ layout: base
<div class="wrapper article">
<h1>{{ title }}</h1>
<div class="post-time"><time datetime="{{ date | dateIso }}">{{ date | dateReadable }}</time></div>
{% set latest = collections.posts | getLatestVersion %}
{% if version and latest > version %}
<p class="info">You're currently reading the release announcement for version {{ version }}, but <a href="/#downloads">a newer version ({{ latest }})</a> is now available.</p>
{% endif %}
{{ content | safe }}
</div>
</article>
{% if version %}
{% include "../_includes/downloads.njk" %}
{% endif %}
almet marked this conversation as resolved.
Show resolved Hide resolved
</article>
Loading