use v6.e.PREVIEW; unit module Render::Head; use HTML::Functional; use Render::Util; use DB::BlogMeta; sub generate-head(BlogMeta:D $meta, $title?, $description?) is export { head [ meta :charset; meta :name, :content; meta :author :content; do if $title ~~ Str:D { title "$title — {$meta.title}"; } else { title $meta.title; } # Add description, if one exists optl $description ~~ Str:D, -> {meta :description :content($description)}; # Preconnect to all our resource sources link :rel :href; link :rel :href; link :rel :href :crossorigin; link :rel :href; # Load fonts, Iosevka for code, Open Sans for content, and boxicons for # icons link :rel, :href; link :rel, :href; link :rel, :href; # Link our style sheets link :rel, :href; link :rel, :href; link :rel, :href; link :rel, :href; ] } sub site-header(BlogMeta:D $meta) is export { sub header-link($name, $path, $icon) { a :href("$path"), [ icon $icon; span $name; ] } header :class, [ div :class, [ # TODO: Use a real image here $meta.title ]; div :class, [ $meta.tagline ]; div :class, [ header-link 'Index', '/index.html', 'home'; header-link 'All Posts', '/archive.html', 'archive'; header-link 'Tags', '/tags.html', 'purchase-tag-alt'; header-link 'Series', '/series.html', 'book'; header-link 'About', '/about.html', 'info-circle'; header-link 'Feed', '/atom.xml', 'rss'; ]; ] }