diff --git a/src/subcommand/server/templates.rs b/src/subcommand/server/templates.rs index 49c37f64d6..aa592d0262 100644 --- a/src/subcommand/server/templates.rs +++ b/src/subcommand/server/templates.rs @@ -49,6 +49,10 @@ pub(crate) trait PageContent: Display + 'static { { PageHtml::new(self, chain, has_satoshi_index) } + + fn preview_image_url(&self) -> Option> { + None + } } #[cfg(test)] diff --git a/src/subcommand/server/templates/inscription.rs b/src/subcommand/server/templates/inscription.rs index 9481bab3ba..7bdfb4ddd3 100644 --- a/src/subcommand/server/templates/inscription.rs +++ b/src/subcommand/server/templates/inscription.rs @@ -11,6 +11,10 @@ impl PageContent for InscriptionHtml { fn title(&self) -> String { format!("Inscription {}", self.inscription_id) } + + fn preview_image_url(&self) -> Option> { + Some(Trusted(format!("/content/{}", self.inscription_id))) + } } #[cfg(test)] diff --git a/templates/page.html b/templates/page.html index 1177dcd61d..6d3d93df8c 100644 --- a/templates/page.html +++ b/templates/page.html @@ -4,6 +4,9 @@ +%% if let Some(url) = self.content.preview_image_url() { + +%% } {{ self.content.title() }} diff --git a/tests/server.rs b/tests/server.rs index 4e04680c8b..a217ba22c9 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -54,7 +54,8 @@ fn inscription_page() { TestServer::spawn_with_args(&rpc_server, &[]).assert_response_regex( &format!("/inscription/{reveal_tx}"), &format!( - ".*

Inscription {reveal_tx}

+ ".*.* +

Inscription {reveal_tx}

content size
10 bytes