Skip to content

Commit

Permalink
Add amphtml meta tag
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunkomath committed Jan 20, 2024
1 parent 1ec9c72 commit 2a06d08
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <arjunkomath@gmail.com>"]
Expand Down
1 change: 1 addition & 0 deletions src/builder/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl Render<'_> {
&self.settings,
url_path,
is_amp,
is_amp_template,
)?,
content,
styles: self.get_global_styles()?,
Expand Down
8 changes: 7 additions & 1 deletion src/builder/seo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub fn generate_open_graph_tags(
settings: &Settings,
url_path: &str,
is_amp: bool,
is_amp_template: bool,
) -> Result<String> {
let title = settings.meta.title.clone();
let description = settings.meta.description.clone();
Expand All @@ -87,7 +88,12 @@ pub fn generate_open_graph_tags(
description
));

if is_amp {
if is_amp && !is_amp_template {
tags.push(format!(
"<link rel=\"amphtml\" href=\"{}{}amp\">",
base_url, url_path
));
} else if is_amp_template && is_amp {
tags.push(format!(
"<link rel=\"canonical\" href=\"{}{}\">",
base_url, url_path
Expand Down

0 comments on commit 2a06d08

Please sign in to comment.