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

added facebook-domain-verification meta header under ftd.document #1685

Merged
merged 2 commits into from
Jan 4, 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
12 changes: 12 additions & 0 deletions fastn-js/js/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ fastn_dom.PropertyKind = {
MetaOGImage: 97,
MetaTwitterImage: 98,
MetaThemeColor: 99,
MetaFacebookDomainVerification: 123,
},
Shadow: 100,
CodeTheme: 101,
Expand Down Expand Up @@ -2582,6 +2583,17 @@ class Node2 {
"theme-color",
fastn_utils.getStaticValue(staticValue.get("light")),
);
} else if (
kind === fastn_dom.PropertyKind.DocumentProperties.MetaFacebookDomainVerification
) {
if (fastn_utils.isNull(staticValue)) {
this.removeMetaTagByName("facebook-domain-verification");
return;
}
this.addMetaTagByName(
"facebook-domain-verification",
fastn_utils.getStaticValue(staticValue),
);
} else if (
kind === fastn_dom.PropertyKind.IntegerValue ||
kind === fastn_dom.PropertyKind.DecimalValue ||
Expand Down
4 changes: 4 additions & 0 deletions fastn-js/src/property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ pub enum PropertyKind {
MetaOGImage,
MetaTwitterImage,
MetaThemeColor,
MetaFacebookDomainVerification,
Favicon,
Selectable,
BackdropFilter,
Expand Down Expand Up @@ -570,6 +571,9 @@ impl PropertyKind {
PropertyKind::MetaThemeColor => {
"fastn_dom.PropertyKind.DocumentProperties.MetaThemeColor"
}
PropertyKind::MetaFacebookDomainVerification => {
"fastn_dom.PropertyKind.DocumentProperties.MetaFacebookDomainVerification"
}
PropertyKind::Favicon => "fastn_dom.PropertyKind.Favicon",
PropertyKind::Selectable => "fastn_dom.PropertyKind.Selectable",
PropertyKind::BackdropFilter => "fastn_dom.PropertyKind.BackdropFilter",
Expand Down
6 changes: 6 additions & 0 deletions ftd/src/interpreter/things/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10960,6 +10960,12 @@ pub fn document_function() -> ftd::interpreter::ComponentDefinition {
.into_optional()
.into_kind_data(),
),
ftd::interpreter::Argument::default(
"facebook-domain-verification",
ftd::interpreter::Kind::string()
.into_optional()
.into_kind_data(),
),
ftd::interpreter::Argument::default(
"title",
ftd::interpreter::Kind::string()
Expand Down
17 changes: 17 additions & 0 deletions ftd/src/js/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ pub struct DocumentMeta {
pub description: Option<ftd::js::Value>,
pub og_description: Option<ftd::js::Value>,
pub twitter_description: Option<ftd::js::Value>,
pub facebook_domain_verification: Option<ftd::js::Value>,
pub og_image: Option<ftd::js::Value>,
pub twitter_image: Option<ftd::js::Value>,
pub theme_color: Option<ftd::js::Value>,
Expand Down Expand Up @@ -1524,6 +1525,11 @@ impl DocumentMeta {
properties,
arguments,
),
facebook_domain_verification: ftd::js::value::get_optional_js_value(
"facebook-domain-verification",
properties,
arguments,
),
}
}

Expand Down Expand Up @@ -1670,6 +1676,17 @@ impl DocumentMeta {
));
}

if let Some(ref facebook_domain_verification) = self.facebook_domain_verification {
component_statements.push(fastn_js::ComponentStatement::SetProperty(
facebook_domain_verification.to_set_property(
fastn_js::PropertyKind::MetaFacebookDomainVerification,
doc,
element_name,
rdata,
),
));
}

component_statements
}
}
Expand Down
1 change: 1 addition & 0 deletions ftd/t/js/22-document.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ twitter-description: This is twitter description
og-image: $fastn-image.light
twitter-image: $fastn-image.dark
theme-color: white
facebook-domain-verification: 7uedwv99dgux8pbshcr7jzhb3l3hvu

-- ftd.text: This is document component

Expand Down
1 change: 1 addition & 0 deletions ftd/t/js/22-document.html

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

Loading