Commit
Message
Changed Files (8)
-
modified CHANGELOG.md
diff --git a/CHANGELOG.md b/CHANGELOG.md index 618162b..630883c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## [unreleased] +### 🚀 Features + +- If a `static` dir is found in custom theme folder, copy it to output + ### ⚙️ Miscellaneous Tasks - Fix git push before git tag in release task -
modified README.md
diff --git a/README.md b/README.md index db77e9f..ca0457a 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,8 @@ Then run `abbaye build` to build the site. The site will be generated in the `pu Now you can copy the contents of `public/` to your web server to deploy the site. For instance, with rsync: `rsync --progress -avz --links --perms --update public/ ololduck@vit.am:public_html/abbaye/` +To have a look at all the available configuration options, please refer to the documentation of [`config::AbbayeConfig`]. + ### ✨ Customization ✨ You can dump the default theme/templates to your local filesystem with `abbaye dump-theme`. -
modified abbaye.toml
diff --git a/abbaye.toml b/abbaye.toml index ae55e08..43b9070 100644 --- a/abbaye.toml +++ b/abbaye.toml @@ -2,6 +2,11 @@ name = "Abbaye" base_url = "http://vit.am/~ololduck/abbaye/" repo_url = "https://git.sr.ht/~ololduck/abbaye" +fediverse_creator = "@ololduck@vit.am" + +[site.opengraph] +image = "/latest/logo-wordmark.svg" +image_alt = "Abbaye logo" [version_extractor] type = "git" @@ -9,13 +14,13 @@ tag_prefix = "v" [changelog] -[[builders]] # builds the project using cargo build --release +[[builders]] # builds the project using cargo build --release type = "cargo" targets = ["x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl"] -[[builders]] # generates documentation using cargo doc +[[builders]] # generates documentation using cargo doc type = "cargo_doc" no_deps = true [[builders]] -type = "archive" # creates a compressed tarball of the source code (can be of anything, really) +type = "archive" # creates a compressed tarball of the source code (can be of anything, really) -
modified src/config.rs
diff --git a/src/config.rs b/src/config.rs index 323c294..a457246 100644 --- a/src/config.rs +++ b/src/config.rs @@ -29,6 +29,26 @@ pub struct SiteConfig { /// An optional language code for the website (e.g. `"en"` or `"fr"`). /// When set, the generated HTML will include a `lang` attribute on the `<html>` tag. Defaults to `"en"`. pub lang: Option<String>, + /// If you have a Fediverse account, you can set this to your username to enable Fediverse integration. (don't forget the starting '@' !) + pub fediverse_creator: Option<String>, + /// OpenGraph configuration for the website. + pub opengraph: Option<OpenGraphConfig>, +} + +/// OpenGraph configuration for the website. +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct OpenGraphConfig { + /// OpenGraph type of the website. It will be used as the `og:type` meta tag. + /// Note: by default, the value "website" will be enforced for the version listing page and "article" for the release notes page. + pub r#type: Option<String>, + /// URL of the website's image. + pub image: String, + /// Alt text for the website's image. + pub image_alt_text: Option<String>, + /// URL of the website. If not set, the `base_url` will be used instead. If `base_url` is not set either, the world explodes. Think of the kittens. + pub url: Option<String>, + /// Author of the website. Used on release notes pages to indicate the author. + pub author: Option<String>, } /// A full configuration for the Abbaye site generator. @@ -60,10 +80,15 @@ pub struct SiteConfig { /// #[derive(Debug, Clone, Deserialize, Serialize)] pub struct AbbayeConfig { + /// Metadata about the site. pub site: SiteConfig, + /// which version extractor to use to extract the version(s) of the project pub version_extractor: AnyVersionExtractor, + /// Configuration for the changelog extractor. pub changelog: ChangelogConfig, + /// Builders to run during the build process. pub builders: Vec<AnyBuilder>, + /// Where to output generated files. Defaults to `public`. #[serde(default = "abbaye_output_dir")] pub output_dir: Option<PathBuf>, } -
modified src/main.rs
diff --git a/src/main.rs b/src/main.rs index 07f5793..6cdd0c9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,6 +91,8 @@ //! Now you can copy the contents of `public/` to your web server to deploy the site. For instance, with rsync: //! `rsync --progress -avz --links --perms --update public/ ololduck@vit.am:public_html/abbaye/` //! +//! To have a look at all the available configuration options, please refer to the documentation of [`config::AbbayeConfig`]. +//! //! ### ✨ Customization ✨ //! //! You can dump the default theme/templates to your local filesystem with `abbaye dump-theme`. @@ -280,6 +282,8 @@ async fn main() -> Result<()> { base_url: None, repo_url: None, lang: None, + fediverse_creator: None, + opengraph: None, }, version_extractor: AnyVersionExtractor::Git(GitVersionConfig { tag_prefix: Some("v".to_string()), -
modified src/site.rs
diff --git a/src/site.rs b/src/site.rs index a15df13..28c280b 100644 --- a/src/site.rs +++ b/src/site.rs @@ -232,6 +232,7 @@ pub async fn build_site(config: AbbayeConfig) -> Result<()> { // ── 8. Version index.html ───────────────────────────────────────────────── let mut version_ctx = Context::new(); + version_ctx.insert("config", &config); version_ctx.insert("project_name", &config.site.name); version_ctx.insert("lang", &config.site.lang); version_ctx.insert("repo_url", &config.site.repo_url); @@ -270,6 +271,7 @@ pub async fn build_site(config: AbbayeConfig) -> Result<()> { .map(|u| u.trim_end_matches('/')); let mut root_ctx = Context::new(); + root_ctx.insert("config", &config); root_ctx.insert("project_name", &config.site.name); root_ctx.insert("lang", &config.site.lang); root_ctx.insert("repo_url", &config.site.repo_url); -
modified src/templates/root_index.html.j2
diff --git a/src/templates/root_index.html.j2 b/src/templates/root_index.html.j2 index b209fb1..9db7637 100644 --- a/src/templates/root_index.html.j2 +++ b/src/templates/root_index.html.j2 @@ -1,8 +1,22 @@ <!doctype html> -<html lang="{{lang|default(value='en')}}"> +<html prefix="og: https://ogp.me/ns#" lang="{{lang|default(value='en')}}"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> + {% if config.site.fediverse_creator %}<meta name="fediverse:creator" content="{{ config.site.fediverse_creator }}" />{% endif %} + {% if config.site.opengraph %} + <meta property="og:title" content="{{ project_name }}" /> + <meta property="og:type" content="{{ config.site.opengraph.type|default(value='website') }}" /> + <meta property="og:image" content="{{ config.site.opengraph.image }}" /> + {% if config.site.opengraph.image_alt_text %} + <meta property="og:image:alt" content="{{ config.site.opengraph.image_alt_text }}" /> + {% endif %} + <meta property="og:url" content="{{ config.site.opengraph.url|default(value=config.site.base_url)|safe }}" /> + <meta property="og:site_name" content="{{ project_name }}" /> + {% if config.site.opengraph.description %} + <meta property="og:description" content="{{ config.site.opengraph.description }}" /> + {% endif %} + {% endif %} <title>{{ project_name }}</title> <link rel="alternate" -
modified src/templates/version_index.html.j2
diff --git a/src/templates/version_index.html.j2 b/src/templates/version_index.html.j2 index ab578d4..aa53dd3 100644 --- a/src/templates/version_index.html.j2 +++ b/src/templates/version_index.html.j2 @@ -1,8 +1,22 @@ <!doctype html> -<html lang="{{lang|default(value='en')}}"> +<html prefix="og: https://ogp.me/ns#" lang="{{lang|default(value='en')}}"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> + {% if config.site.fediverse_creator %}<meta name="fediverse:creator" content="{{ config.site.fediverse_creator }}" />{% endif %} + {% if config.site.opengraph %} + <meta property="og:title" content="{{ project_name }} — {{ version }}" /> + <meta property="og:type" content="{{ config.site.opengraph.type|default(value='article') }}" /> + <meta property="og:image" content="{{ config.site.opengraph.image }}" /> + {% if config.site.opengraph.image_alt_text %} + <meta property="og:image:alt" content="{{ config.site.opengraph.image_alt_text }}" /> + {% endif %} + <meta property="og:url" content="{{ config.site.opengraph.url|default(value=config.site.base_url)|safe }}/{{ version }}" /> + <meta property="og:site_name" content="{{ project_name }}" /> + {% if config.site.opengraph.description %} + <meta property="og:description" content="{{ config.site.opengraph.description }}" /> + {% endif %} + {% endif %} <title>{{ project_name }} — {{ version }}</title> <style> *,