coryd.dev/src/includes/metadata/index.liquid

96 lines
3.7 KiB
Text

{%- assign fullUrl = globals.url | append: page.url -%}
{%- capture pageTitle -%}
{%- if page.title -%}
{{ page.title | append: ' • ' | append: globals.site_name }}
{%- elsif title -%}
{{ title | append: ' • ' | append: globals.site_name }}
{%- else -%}
{{ globals.site_name }}
{%- endif -%}
{%- endcapture -%}
{%- capture pageDescription -%}
{% if page.description %}
{{ page.description }}
{% elsif description %}
{{ description }}
{% else %}
{{ globals.site_description }}
{% endif %}
{%- endcapture -%}
{%- assign ogImage = globals.cdn_url | append: globals.avatar -%}
{%- case schema -%}
{%- when 'artist' -%}
{% render "fetchers/artist.php.liquid" %}
{%- when 'genre' -%}
{% render "fetchers/genre.php.liquid" %}
{%- when 'book' -%}
{% render "fetchers/book.php.liquid" %}
{%- when 'movie' -%}
{% render "fetchers/movie.php.liquid" %}
{%- when 'show' -%}
{% render "fetchers/show.php.liquid" %}
{%- when 'tags' -%}
{% render "fetchers/tags.php.liquid" %}
{%- when 'blog' -%}
{%- assign pageTitle = post.title -%}
{%- assign pageDescription = post.description -%}
{%- assign ogImage = globals.cdn_url | append: post.image -%}
{%- when 'music-index', 'music-week-artists' -%}
{%- assign ogImage = globals.cdn_url | append: music.week.artists[0].grid.image -%}
{%- when 'music-week-albums', 'music-week-tracks' -%}
{%- assign ogImage = globals.cdn_url | append: music.week.albums[0].grid.image -%}
{%- when 'music-month-artists' -%}
{%- assign ogImage = globals.cdn_url | append: music.month.artists[0].grid.image -%}
{%- when 'music-month-albums' -%}
{%- assign ogImage = globals.cdn_url | append: music.month.albums[0].grid.image -%}
{%- when 'music-releases' -%}
{%- assign ogImage = globals.cdn_url | append: albumReleases.upcoming[0].grid.image -%}
{%- when 'books' -%}
{%- assign overviewBook = books.all | filterBooksByStatus: 'started' | reverse | first %}
{%- assign ogImage = globals.cdn_url | append: overviewBook.image -%}
{%- when 'books-year' -%}
{%- assign pageTitle = 'Books' | append: ' • ' | append: year.value | append: ' • ' | append: globals.site_name -%}
{%- capture pageDescription -%}
Here's what I read in {{ year.value }}.
{%- endcapture -%}
{%- assign bookData = year.data | filterBooksByStatus: 'finished' -%}
{%- assign bookYear = bookData | shuffleArray | first -%}
{%- assign ogImage = globals.cdn_url | append: bookYear.image -%}
{%- when 'favorite-movies' -%}
{%- assign favoriteMovie = movies.favorites | shuffleArray | first %}
{%- assign ogImage = globals.cdn_url | append: favoriteMovie.backdrop -%}
{%- when 'favorite-shows' -%}
{%- assign favoriteShow = tv.favorites | shuffleArray | first %}
{%- assign ogImage = globals.cdn_url | append: favoriteShow.backdrop -%}
{%- when 'watching' -%}
{%- assign overviewMovie = movies.recentlyWatched | first %}
{%- assign ogImage = globals.cdn_url | append: overviewMovie.backdrop -%}
{%- when 'upcoming-shows' -%}
{%- assign upcomingShow = upcomingShows.watching | shuffleArray | first %}
{%- assign ogImage = globals.cdn_url | append: upcomingShow.backdrop -%}
{%- when 'page' -%}
{%- assign pageDescription = page.description -%}
{% endcase %}
{%- if type == 'dynamic' -%}
{% render "metadata/dynamic.php.liquid"
fullUrl:fullUrl,
pageTitle:pageTitle,
pageDescription:pageDescription,
ogImage:ogImage,
globals:globals,
%}
{%- else -%}
{% render "metadata/static.liquid"
fullUrl:fullUrl,
pageTitle:pageTitle,
pageDescription:pageDescription
ogImage:ogImage,
globals:globals,
%}
{%- endif -%}
{% render "metadata/base.liquid"
pageTitle:pageTitle,
globals:globals,
eleventy:eleventy,
appVersion:appVersion,
%}