This repository has been archived on 2025-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
coryd.dev-eleventy/src/includes/base.liquid
2024-10-22 13:09:48 -07:00

96 lines
5.3 KiB
Text

{%- assign fullUrl = globals.url | append: page.url -%}
{%- assign pageTitle = globals.site_name -%}
{%- assign pageDescription = globals.site_description -%}
{%- case schema -%}
{%- when 'blog' -%}
{%- assign pageTitle = post.title -%}
{%- assign pageDescription = post.description | markdown | strip_html | default: globals.site_description -%}
{%- when 'music-index' -%}
{%- assign pageTitle = 'Music / ' | append: globals.site_name -%}
{%- when 'music-period' -%}
{%- assign pageTitle = 'Music / ' | append: page.title | append: ' / ' | append: globals.site_name -%}
{%- when 'books-year' -%}
{%- assign pageTitle = year.value | append: ' / Books / ' | append: globals.site_name -%}
{%- when 'page' -%}
{%- assign pageTitle = page.title | append: ' / ' | append: globals.site_name -%}
{%- else -%}
{%- assign pageTitle = globals.site_name -%}
{%- endcase -%}
{%- if page.description -%}
{%- assign pageDescription = page.description -%}
{%- elsif description -%}
{%- assign pageDescription = description -%}
{%- endif -%}
{%- assign ogImage = globals.cdn_url | append: globals.avatar -%}
{%- case schema -%}
{%- when 'music' -%}
{%- assign ogImage = globals.cdn_url | append: page.image -%}
{%- when 'music-index' -%}
{%- assign ogImage = globals.cdn_url | append: music.week.artists[0].grid.image -%}
{%- when 'watching' or 'favorite-movies' -%}
{%- assign featuredMovie = movies.recentlyWatched | first -%}
{%- assign ogImage = globals.cdn_url | append: featuredMovie.grid.backdrop -%}
{%- when 'watching-shows' or 'favorite-shows' -%}
{%- assign featuredShow = tv.recentlyWatched | first -%}
{%- assign ogImage = globals.cdn_url | append: featuredShow.grid.backdrop -%}
{%- when 'books' or 'books-year' -%}
{%- assign featuredBook = books.all | filterBooksByStatus: 'started' | reverse | first -%}
{%- assign ogImage = globals.cdn_url | append: featuredBook.grid.image -%}
{%- endcase -%}
{%- assign escapedPageDescription = pageDescription | escape -%}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title data-dynamic="title">{{ pageTitle }}</title>
<link rel="preload" href="/assets/fonts/ml.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="/assets/fonts/mlb.woff2" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="stylesheet" href="/assets/styles/index.css?v={% appVersion %}" type="text/css" />
<link rel="canonical" href="{{ fullUrl }}" />
<meta property="og:title" content="{{ pageTitle }}" data-dynamic="og:title" />
<meta name="description" content="{{ escapedPageDescription }}" data-dynamic="description" />
<meta property="og:description" content="{{ escapedPageDescription }}" data-dynamic="og:description" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ fullUrl }}" data-dynamic="og:url" />
<meta property="og:image" content="{{ ogImage }}?class=w800" data-dynamic="og:image" />
<meta name="theme-color" content="{{ globals.theme_color }}" />
<meta name="fediverse:creator" content="{{ globals.mastodon }}" />
<meta name="generator" content="Eleventy">
<meta name="robots" content="noai, noimageai">
<link href="{{ globals.cdn_url }}{{ globals.avatar_transparent }}?class=w50&v={% appVersion %}" rel="icon" sizes="any">
<link href="{{ globals.cdn_url }}{{ globals.avatar_transparent }}?class=w50&v={% appVersion %}&type=svg" rel="icon" type="image/svg+xml">
<link href="{{ globals.cdn_url }}{{ globals.avatar }}?class=w800&v={% appVersion %}" rel="apple-touch-icon">
<link type="application/atom+xml" rel="alternate" title="Posts / {{ globals.site_name }}" href="https://coryd.dev/feeds/posts">
<link rel="alternate" href="https://coryd.dev/feeds/links" title="Links / {{ globals.site_name }}" type="application/rss+xml">
<link rel="alternate" href="https://coryd.dev/feeds/movies" title="Movies / {{ globals.site_name }}'s movies feed" type="application/rss+xml">
<link rel="alternate" href="https://coryd.dev/feeds/books" title="Books / {{ globals.site_name }}" type="application/rss+xml">
<link rel="alternate" href="https://coryd.dev/feeds/album-releases" title="Album releases / {{ globals.site_name }}" type="application/rss+xml">
<link rel="alternate" href="https://coryd.dev/feeds/all" title="All activity / {{ globals.site_name }}" type="application/rss+xml">
<script defer src="/assets/scripts/index.js?v={% appVersion %}"></script>
<script defer data-domain="coryd.dev" src="/js/script.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
<noscript>
<style>.client-side {display:none}</style>
</noscript>
</head>
<body>
<script>
(() => {
const currentTheme = sessionStorage?.getItem('theme')
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)').matches
const root = document.documentElement
const themeToSet = currentTheme || (prefersDarkScheme ? 'dark' : 'light')
if (!currentTheme) sessionStorage?.setItem('theme', themeToSet)
root.setAttribute('data-theme', themeToSet)
})()
</script>
{{ content }}
</body>
</html>