{%- comment -%} One stream item (Mastodon / Pixelfed / YouTube / TikTok / FitPub / Presentations / Dictionary, or a blog post), used by the /stream/ timeline and the single-item layout. Pass the item as include.post; include.single drops the permalink. No embeds or iframes: plain text and only, so the same markup works in a newsletter email. Cross-posts come from _data/stream_crossposts.yml ("Also on" links). {%- endcomment -%} {%- assign p = include.post -%} {%- case p.source -%} {%- when "mastodon" -%}{%- assign icon = "fab fa-mastodon" -%}{%- assign label = "Mastodon" -%} {%- when "pixelfed" -%}{%- assign icon = "fas fa-camera-retro" -%}{%- assign label = "Pixelfed" -%} {%- when "youtube" -%}{%- assign icon = "fab fa-youtube" -%}{%- assign label = "YouTube" -%} {%- when "tiktok" -%}{%- assign icon = "fab fa-tiktok" -%}{%- assign label = "TikTok" -%} {%- when "fitpub" -%}{%- assign icon = "fas fa-person-running" -%}{%- assign label = "FitPub" -%} {%- when "blog" -%}{%- assign icon = "fas fa-pen-nib" -%}{%- assign label = "Blog" -%} {%- when "presentations" -%}{%- assign icon = "fas fa-person-chalkboard" -%}{%- assign label = "Presentations" -%} {%- when "dictionary" -%}{%- assign icon = "fas fa-book" -%}{%- assign label = "Dictionary" -%} {%- else -%}{%- assign icon = "fas fa-comment" -%}{%- assign label = "Post" -%} {%- endcase -%} {%- if p.source == "dictionary" -%}{%- assign item_date = p.added_to_project -%}{%- else -%}{%- assign item_date = p.date -%}{%- endif -%} {%- assign media_count = p.media | size -%} {%- if p.source == "blog" or p.source == "dictionary" -%}{%- assign xkey = "site:" | append: p.url -%}{%- else -%}{%- assign xkey = p.source | append: ":" | append: p.post_id -%}{%- endif -%} {%- assign also = site.data.stream_crossposts[xkey] -%}
{{ label }} {%- if include.single -%} {%- else -%} {%- endif -%}
{%- if p.in_reply_to -%} {%- comment -%} Replies: say what they answer. My own earlier post links to its page here when it's in the stream. {%- endcomment -%} {%- assign r = p.in_reply_to -%}
{%- if r.self -%} {%- assign parent = site.stream | where: "post_id", r.id | first -%} {% if parent %}Continuing my earlier post{% elsif r.url != "" %}Continuing my earlier post{% else %}Continuing my earlier post{% endif %} {%- else %} Replying to {% if r.url != "" %}@{{ r.acct | split: "@" | first }}{% else %}a post{% endif %} {%- endif -%}
{%- endif -%} {%- if p.source == "presentations" -%} {%- assign pr = p.presentation -%}

{{ p.title }}

{%- if pr.image -%}{{ pr.image_alt | escape }}{%- endif -%} {%- capture where -%}{% if pr.course != "" %}{{ pr.course }}{% endif %}{% if pr.course != "" and pr.location %} · {% endif %}{{ pr.location }}{%- endcapture -%} {%- if where != "" -%}
{{ where }}
{%- endif -%} {%- endif -%} {%- if p.source == "dictionary" -%} {%- comment -%} Read from the entry's HTML: part of speech is the first

; the definition is the first quoted line, else the first numbered sense, else the first paragraph under the heading. {%- endcomment -%} {%- assign html = p.content | markdownify -%} {%- comment -%} content may still be raw Markdown when the stream page renders {%- endcomment -%} {%- assign pos = "" -%} {%- if html contains "" | slice: 1 | first | split: "<" | first | strip -%}{%- endif -%} {%- if html contains "
" -%}{%- assign def = html | split: "
" | slice: 1 | first | split: "
" | first -%} {%- elsif html contains "
    " -%}{%- assign def = html | split: "
      " | slice: 1 | first | split: "
    1. " | slice: 1 | first | split: "
    2. " | first -%} {%- else -%}{%- assign def = html | split: "

" | last | split: "

" | first -%}{%- endif -%} {%- assign def = def | strip_html | strip | split: "; “" | first | truncate: 220 -%}

{{ p.title }}{% if pos != "" %} {{ pos | downcase }}{% endif %}

{%- if def != "" -%}
{{ def }}
{%- endif -%} {%- if p.source-author -%}
Came across it reading {{ p.source-author }}
{%- endif -%} {%- endif -%} {%- if p.show_title or p.source == "blog" -%}

{% if p.source == "blog" %}{{ p.title }}{% else %}{{ p.title }}{% endif %}

{%- endif -%} {%- if p.source == "blog" -%} {%- if p.header.teaser -%}{%- endif -%}
{{ p.excerpt | strip_html | truncate: 280 }}
{%- endif -%} {%- if p.video -%} {{ p.title | escape }} {%- if p.video.duration > 0 -%} {%- assign mins = p.video.duration | divided_by: 60 -%}{%- assign secs = p.video.duration | modulo: 60 -%} {{ mins }}:{% if secs < 10 %}0{% endif %}{{ secs }} {%- endif -%} {%- endif -%} {%- if p.activity -%} {%- assign a = p.activity -%} {%- assign hrs = a.duration_s | divided_by: 3600 -%}{%- assign mins = a.duration_s | modulo: 3600 | divided_by: 60 -%}{%- assign secs = a.duration_s | modulo: 60 -%} Route map for {{ p.title | escape }} {%- endif -%} {%- if p.source == "blog" or p.source == "presentations" or p.source == "dictionary" -%} {%- elsif include.single or p.source != "youtube" -%}
{{ p.content_html }}
{%- else -%}
{{ p.post_text | strip_newlines | truncate: 200 }}
{%- endif -%} {%- if media_count > 0 -%}
{%- for m in p.media -%} {%- if m.type == "image" -%} {{ m.alt | escape }} {%- else -%} {%- endif -%} {%- endfor -%}
{%- endif -%} {%- if p.link_card -%}
{%- if p.link_card.image -%}{%- endif -%}
{{ p.link_card.title }}
{%- if p.link_card.description != "" -%}
{{ p.link_card.description | truncate: 140 }}
{%- endif -%} {%- assign host = p.link_card.url | split: "/" -%}
{{ host[2] | remove: "www." }}
{%- endif -%} {%- comment -%} "View on my site · Pixelfed · Mastodon": the first is this post's page here, then the original, then cross-posts {%- endcomment -%}