From 2a06d084167a222bdd2507897321cae815dd305e Mon Sep 17 00:00:00 2001 From: Arjun Komath Date: Sat, 20 Jan 2024 16:32:32 +1100 Subject: [PATCH] Add amphtml meta tag --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/builder/render.rs | 1 + src/builder/seo.rs | 8 +++++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59d7702..82eeb2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1707,7 +1707,7 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rustyink" -version = "0.2.0" +version = "0.2.1" dependencies = [ "anyhow", "async-recursion", diff --git a/Cargo.toml b/Cargo.toml index 1b38c5b..bba4d4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustyink" -version = "0.2.0" +version = "0.2.1" edition = "2021" description = "Blazing fast static site generator" authors = ["Arjun Komath "] diff --git a/src/builder/render.rs b/src/builder/render.rs index 9039553..e25f8d3 100644 --- a/src/builder/render.rs +++ b/src/builder/render.rs @@ -114,6 +114,7 @@ impl Render<'_> { &self.settings, url_path, is_amp, + is_amp_template, )?, content, styles: self.get_global_styles()?, diff --git a/src/builder/seo.rs b/src/builder/seo.rs index e5bf836..fe264bd 100644 --- a/src/builder/seo.rs +++ b/src/builder/seo.rs @@ -62,6 +62,7 @@ pub fn generate_open_graph_tags( settings: &Settings, url_path: &str, is_amp: bool, + is_amp_template: bool, ) -> Result { let title = settings.meta.title.clone(); let description = settings.meta.description.clone(); @@ -87,7 +88,12 @@ pub fn generate_open_graph_tags( description )); - if is_amp { + if is_amp && !is_amp_template { + tags.push(format!( + "", + base_url, url_path + )); + } else if is_amp_template && is_amp { tags.push(format!( "", base_url, url_path