{
  "$schema": "./.schemas/page.schema.json",
  "title": "Feed",
  "title_from": {
    "ref": "feed",
    "value": "title"
  },
  "icon": "dot.radiowaves.up.forward",
  "sidebar": false,
  "params": {
    "feed": {
      "list_key": "news-feeds",
      "example": "h0000000000000000"
    }
  },
  "sources": {
    "feed": {
      "feeds": {
        "list": "news-feeds",
        "only": "{param.feed}"
      },
      "every": "30m"
    }
  },
  "cards": [
    {
      "id": "posts",
      "type": "list",
      "max_items": 10,
      "items": [],
      "source": {
        "ref": "feed",
        "empty": {
          "when": {
            "path": "count",
            "equals": 0
          },
          "text": "No posts yet"
        },
        "map": {
          "items": {
            "each": "items",
            "limit": 30,
            "fields": {
              "text": {
                "template": "{title|clip:120}"
              },
              "subtitle": {
                "if": {
                  "path": "summary",
                  "exists": true
                },
                "then": {
                  "template": "{summary|clip:80}"
                }
              },
              "detail": {
                "if": {
                  "path": "published",
                  "exists": true
                },
                "then": {
                  "template": "{published|ago}"
                }
              },
              "url": "url"
            }
          }
        }
      }
    },
    {
      "id": "facts",
      "type": "facts",
      "label": "Feed",
      "items": [
        {
          "key": "Newest post",
          "value": "—"
        },
        {
          "key": "Site",
          "value": "—"
        },
        {
          "key": "Posts in the feed",
          "value": "—"
        }
      ],
      "source": {
        "ref": "feed",
        "map": {
          "items[0].value": {
            "if": {
              "path": "items[0].published",
              "exists": true
            },
            "then": {
              "template": "{items[0].published|ago}"
            },
            "else": {
              "template": "Not dated"
            }
          },
          "items[1].value": {
            "if": {
              "path": "url",
              "exists": true
            },
            "then": {
              "template": "{url|origin}"
            },
            "else": {
              "template": "—"
            }
          },
          "items[1].url": {
            "if": {
              "path": "url",
              "exists": true
            },
            "then": "url"
          },
          "items[2].value": {
            "template": "{count}"
          }
        }
      }
    }
  ]
}
