{% macro social_metadata(record, schema_type='WebPage', og_type='website', project=none) -%}
{% set site_url = 'https://www.labyricorn.com' %}
{% set canonical_url = site_url ~ record.url_path %}
{% set default_image_url = site_url ~ '/static/labyricorn-social-card.png' %}
{% set image_url = default_image_url %}
{% if record.social_image %}
{% if record.social_image.startswith('https://') %}
{% set image_url = record.social_image %}
{% elif record.social_image.startswith('/') %}
{% set image_url = site_url ~ record.social_image %}
{% else %}
{% set image_url = site_url ~ record.url_path ~ record.social_image %}
{% endif %}
{% endif %}
{% set social_title = record.title|default('Labyricorn', true)|striptags|trim %}
{% set base_description = record.summary|default('Labyricorn developer devlog and project hub', true)|striptags|trim %}
{% set social_description = base_description|truncate(220, true, '…') %}
{% if schema_type == 'TechArticle' and project %}
{% set social_title = record.title ~ ' — ' ~ project.title ~ ' Devlog' %}
{% set social_description = (project.title ~ ' devlog — ' ~ base_description)|truncate(220, true, '…') %}
{% elif schema_type == 'SoftwareSourceCode' and record.status %}
{% set social_description = (base_description ~ ' Status: ' ~ (record.status|capitalize) ~ '.')|truncate(220, true, '…') %}
{% endif %}
{% if record.author %}{% endif %}
{% if og_type == 'article' and record.date %}{% endif %}
{% if og_type == 'article' and record.updated %}{% endif %}
{%- endmacro %}
{% macro share_controls(record, content_kind='page', project=none) -%}
{% set canonical_url = 'https://www.labyricorn.com' ~ record.url_path %}
{% set share_title = record.title|striptags|trim %}
{% if project %}{% set share_title = project.title ~ ' devlog: ' ~ record.title %}{% endif %}
{% set share_description = record.summary|default('', true)|striptags|trim|truncate(180, true, '…') %}
{% set bluesky_text = (share_title|truncate(210, true, '…')) ~ ' ' ~ canonical_url %}
{%- endmacro %}