{
void write_header(std::ostream& ost,
const std::string& title,
const std::string& title_txt,
const std::string& description,
const std::string& author,
const std::string& relpath,
bool has_feed)
{
using namespace hemplate; // NOLINT
using namespace hemplate::html; // NOLINT
using hemplate::html::div;
using hemplate::html::link;
ost << html::doctype();
ost << html::html().set("lang", "en");
ost << html::head();
ost << html::title(title);
ost << doctype();
ost << html({{"lang", "en"}});
ost << head();
ost << title(title_txt);
// Meta tags
ost << html::meta({{"charset", "UTF-8"}});
ost << html::meta({{"name", "author"}, {"content", author}});
ost << html::meta({{"name", "description"}, {"content", description}});
ost << meta({{"charset", "UTF-8"}});
ost << meta({{"name", "author"}, {"content", author}});
ost << meta({{"name", "description"}, {"content", description}});
ost << html::meta({{"content", "width=device-width, initial-scale=1"},
{"name", "viewport"}});
ost << 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");
ost << link({
{"rel", "stylesheet"},
{"type", "text/css"},
{"href", args.resource_url + "/css/index.css"},
});
ost << link({
{"rel", "stylesheet"},
{"type", "text/css"},
{"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"}});
ost << 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"}});
ost << 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")
.set("id", "theme_switch")
.set("class", "theme_switch");
ost << html::div().set("id", "content");
html::div().tgl_state();
ost << html::main();
ost << html::label(" ")
.set("for", "theme_switch")
.set("class", "switch_label");
ost << link({
{"rel", "icon"},
{"type", "image/png"},
{"sizes", "32x32"},
{"href", args.resource_url + "/img/favicon-32x32.png"},
});
ost << link({
{"rel", "icon"},
{"type", "image/png"},
{"sizes", "16x16"},
{"href", args.resource_url + "/img/favicon-16x16.png"},
});
ost << head();
ost << body();
ost << input({
{"type", "checkbox"},
{"id", "theme_switch"},
{"class", "theme_switch"},
});
ost << div({{"id", "content"}});
div().tgl_state();
ost << main();
ost << label({
{"for", "theme_switch"},
{"class", "switch_label"},
});
}
void write_header(std::ostream& ost,