---
permalink: /feed.json
eleventyExcludeFromCollections: true
eleventyImport:
  collections:
    - feed
---
{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "{{ site.name }}",
  "home_page_url": "{{ site.url }}/",
  "feed_url": "{{ site.url }}/feed.json",
  "hubs": [
    {
      "type": "WebSub",
      "url": "https://websubhub.com/hub"
    }
  ],
  "description": "{{ site.description }}",
  "language": "{{ site.locale | default('en') }}",
  "authors": [
    {
      "name": "{{ site.author.name | default(site.name) }}",
      "url": "{{ site.url }}/"
    }
  ],
  "_textcasting": {
    "version": "1.0",
    "about": "https://textcasting.org/"
    {%- set hasSupport = site.support and (site.support.url or site.support.stripe or site.support.lightning or site.support.paymentPointer) %}
    {%- if hasSupport %},
    "support": {{ site.support | textcastingSupport | jsonEncode | safe }}
    {%- endif %}
  },
  {%- set listedFeedPosts = collections.feed | excludeUnlistedPosts %}
  "items": [
    {%- for post in listedFeedPosts %}
    {%- set absolutePostUrl = site.url + post.url %}
    {%- set postImage = post.data.photo %}
    {%- if postImage %}
      {# If photo is an array, use first element (check if first element looks like a URL) #}
      {%- if postImage[0] and (postImage[0] | length) > 10 %}
        {%- set postImage = postImage[0] %}
      {%- endif %}
    {%- endif %}
    {%- if not postImage or postImage == "" %}
      {%- set postImage = post.data.image or (post.content | extractFirstImage) %}
    {%- endif %}
    {
      "id": "{{ absolutePostUrl }}",
      "url": "{{ absolutePostUrl }}",
      "title": {% if post.data.title %}{{ post.data.title | jsonEncode | safe }}{% else %}null{% endif %},
      {%- set _jsonPixel = '<img src="https://cloud.umami.is/noscript.gif?website-id=bbaa63e7-6dd2-4a4e-bbb2-68e9e75600f0&amp;url=/rss' + post.url + '" width="1" height="1" alt="" style="display:none">' %}
      "content_html": {{ (post.content | htmlToAbsoluteUrls(absolutePostUrl) + _jsonPixel) | jsonEncode | safe }},
      "content_text": {{ post.content | striptags | jsonEncode | safe }},
      "date_published": "{{ post.date | dateToRfc3339 }}",
      "date_modified": "{{ (post.data.updated or post.date) | dateToRfc3339 }}"
      {%- if postImage and postImage != "" and (postImage | length) > 10 %},
      "image": "{{ postImage | url | absoluteUrl(site.url) }}"
      {%- endif %}
      {%- set attachments = post.data | feedAttachments %}
      {%- if attachments.length > 0 %},
      "attachments": {{ attachments | jsonEncode | safe }}
      {%- endif %}
    }{% if not loop.last %},{% endif %}
    {%- endfor %}
  ]
}
