void write_header(std::ostream& ost,
const std::string& title,
const std::string& description,
const std::string& author)
const std::string& author,
const std::string& relpath = "./",
bool has_feed = true)
{
using namespace hemplate; // NOLINT
ost << html::doctype();
ost << html::html().set("lang", "en");
ost << html::head()
.add(html::title(title))
// Meta tags
.add(html::meta({{"charset", "UTF-8"}}))
.add(html::meta({{"name", "author"}, {"content", author}}))
.add(html::meta(
{{"name", "description"}, {"content", description}}))
.add(
html::meta({{"content", "width=device-width, initial-scale=1"},
{"name", "viewport"}}))
// Stylesheets
.add(html::link({{"rel", "stylesheet"}, {"type", "text/css"}})
.set("href", args.resource_url + "/css/index.css"))
.add(html::link({{"rel", "stylesheet"}, {"type", "text/css"}})
.set("href", args.resource_url + "/css/colors.css"))
// Icons
.add(
html::link({{"rel", "icon"}, {"type", "image/png"}})
.set("sizes", "32x32")
.set("href", args.resource_url + "/img/favicon-32x32.png"))
.add(html::link({{"rel", "icon"}, {"type", "image/png"}})
.set("sizes", "16x16")
.set("href",
args.resource_url + "/img/favicon-16x16.png"));
ost << html::head();
ost << html::title(title);
// Meta tags
ost << html::meta({{"charset", "UTF-8"}});
ost << html::meta({{"name", "author"}, {"content", author}});
ost << html::meta({{"name", "description"}, {"content", description}});
ost << html::meta({{"content", "width=device-width, initial-scale=1"},
{"name", "viewport"}});
// Stylesheets
ost << html::link({{"rel", "stylesheet"}, {"type", "text/css"}})
.set("href", args.resource_url + "/css/index.css");
ost << html::link({{"rel", "stylesheet"}, {"type", "text/css"}})
.set("href", args.resource_url + "/css/colors.css");
if (has_feed) {
// Rss feed
ost << html::link({{"rel", "alternate"},
{"type", "application/atom+xml"},
{"title", "RSS feed"},
{"href", relpath + "rss.xml"}});
// Atom feed
ost << html::link({{"rel", "alternate"},
{"type", "application/atom+xml"},
{"title", "Atom feed"},
{"href", relpath + "atom.xml"}});
}
// Icons
ost << html::link({{"rel", "icon"}, {"type", "image/png"}})
.set("sizes", "32x32")
.set("href", args.resource_url + "/img/favicon-32x32.png");
ost << html::link({{"rel", "icon"}, {"type", "image/png"}})
.set("sizes", "16x16")
.set("href", args.resource_url + "/img/favicon-16x16.png");
ost << html::head();
ost << html::body();
ost << html::input()
.set("type", "checkbox")