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 { my $final-title = do if $title ~~ Str:D { "$title — {$meta.title}" } else { $meta.title }; [ meta :charset<utf-8>; meta :name<viewport>, :content<width=device-width, initial-scale=1>; meta :author :content<Nathan McCarty>; title $final-title; # Add description, if one exists optl $description ~~ Str:D, -> {meta :description :content(^ $description)}; # Preconnect to all our resource sources link :rel<preconnect> :href<https://static.stranger.systems>; link :rel<preconnect> :href<https://fonts.googleapis.com>; link :rel<preconnect> :href<https://fonts.gstatic.com> :crossorigin; link :rel<preconnect> :href<https://unpkg.com>; # Load fonts, Iosevka for code, Open Sans for content, and boxicons for # icons link :rel<stylesheet>, :href<https://static.stranger.systems/fonts/Iosevka/Iosevka.css>; link :rel<stylesheet>, :href<https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap>; link :rel<stylesheet>, :href<https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css>; # Link our style sheets link :rel<stylesheet>, :href</resources/colors.css>; link :rel<stylesheet>, :href</resources/main.css>; link :rel<stylesheet>, :href</resources/code.css>; link :rel<stylesheet>, :href</resources/admonitions.css>; # Verify mastodon link :rel<me>, :href<https://hachyderm.io/@thatonelutenist>; # Atribute on mastodon meta :name<fediverse:creator>, :content<@thatonelutenist@hachyderm.io>; # Tell dark reader that we'll behave meta :name<color-scheme>, :content<light dark>; # Tell feed readers about our feed link :rel<alternate>, :type<application/atom+xml>, :title($meta.title), :href</atom.xml>; ] } sub site-header(BlogMeta:D $meta) is export { sub header-link($name, $path, $icon) { a :href("$path"), [ icon $icon; span $name; ] } header :class<site-header>, [ div :class<site-logo>, [ # TODO: Use a real image here $meta.title ]; div :class<site-tagline>, [ $meta.tagline ]; div :class<header-links>, [ 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'; ]; ] }