libmedium/templates/index.html

38 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><.= data.title .></title>
</head>
<body>
<main class="container">
<h1><.= data.title .></h1>
<. use chrono::{TimeZone, Utc}; .>
<. let dt = Utc.timestamp_millis(data.created_at); .>
<p class="meta">
<a href="https://medium.com/u/<.= data.creator.id .>" rel="noreferrer">
<.= data.creator.name .></a
>
on <.= dt.format("%b %e, %Y").to_string() .>
</p>
<article>
<. let paragraphs = data.content.body_model.paragraphs; .>
<. for (pindex, p) in paragraphs.iter().enumerate() {.>
<. if pindex == 1 && p.type_ == "H3" {.>
<. continue; .>
<.}.>
<. if p.type_ == "IMG" {.>
<. include!("./img.html"); .>
<.} else if p.type_ == "P" {.>
<. include!("./p.html"); .>
<.}.>
<.}.>
</article>
</main>
</body>
<style>
<. include!("./main.css"); .>
</style>
</html>