Back to Postgresml

Template

pgml-dashboard/src/components/cards/blog/article_preview/template.html

2.10.01.9 KB
Original Source

% let foot = format!(r#"

{}

{}

{}

"#, if meta.author_image.is_some() { format!(r#" "#, meta.author_image.clone().unwrap())} else {String::new() }, if meta.author.is_some() { format!(r#" By {} "#, meta.author.clone().unwrap() )} else {String::new()}, if meta.date.is_some() { meta.date.clone().unwrap().format("%m/%d/%Y").to_string() } else {String::new()} ); %> <% let default = format!(r#" [ {}

{}

{} ]({}) "#, meta.path, if meta.tags.len() > 0 { format!(r#" {} "#, meta.tags[0].clone().to_uppercase())} else {String::new()}, meta.title.clone(), foot ); %> <% if card_type == String::from("featured") {%> [

<% if meta.tags.len() > 0 {%> <%- meta.tags[0].clone().to_uppercase() %> <% } %>

<%- meta.title %>

<% if meta.description.is_some() {%> <%- meta.description.clone().unwrap() %> <% } %> <%- foot %>

](<%-%20meta.path%20%>) <% } else if card_type == String::from("show_image") { %> [ <% if meta.tags.len() > 0 {%> <%- meta.tags[0].clone().to_uppercase() %> <% }%>

<%- meta.title %>

<%- foot %> ](<%-%20meta.path%20%>) <%- default %> <% } else if card_type == String::from("big") { %> [

<% if meta.tags.len() > 0 {%> <%- meta.tags[0].clone().to_uppercase() %> <% } %>

<%- meta.title %>

<% if meta.description.is_some() {%> <%- meta.description.clone().unwrap() %> <% } %> <%- foot %>

](<%-%20meta.path%20%>) <%- default %> <% } else if card_type == String::from("long") { %> [ <% if meta.tags.len() > 0 {%> <%- meta.tags[0].clone().to_uppercase() %> <% }%>

<%- meta.title.clone() %>

<%- foot %> ](<%-%20meta.path%20%>) <%- default %> <% } else { %> <%- default %> <% } %>