bnomei / kirby3-feed

Generate a RSS/JSON-Feed and Sitemap from a Pages-Collection.
https://forum.getkirby.com/t/kirby3-feed-rss-json-sitemap/23574
MIT License
64 stars 7 forks source link

Add support for h-feed #40

Closed MaluNoPeleke closed 3 years ago

MaluNoPeleke commented 3 years ago

Can you add support for h-feeds?

bnomei commented 3 years ago

i want to avoid adding more and more formats. unless they are globally more in use than rss and atom.

see #34 and #36. please use a custom snippet to add h-feeds. feel free to open this issue again if you get stuck doing so. i will try to help yout with that then step by step.

MaluNoPeleke commented 3 years ago

I came up with this simple code in a hfeed.php at top-level but I am not sure if it is okay and valid as I cannot find a real h-feed validator except for this one:

<?php snippet('header') ?>

<main>
  <header>
    <h1><?= $page->title() ?></h1>
  </header>

  <div class="h-feed">
    <h1 class="p-name"><a href="<?= $page->url() ?>" class="u-url">Pelekes Blog</a></h1>
    <?php foreach (page('blog')->children()->listed()->flip() as $item): ?>
    <article>
      <header class="article-header h-entry">
      <time><?= $item->date()->toDate('%d.%m.%Y') ?></time>
        <a href="<?= $item->url() ?>" class="u-url">
          <h2 class="p-name"><?= $item->title() ?></h2>
        </a>
      </header>
      <p><?= $item->description() ?></p>
    </article>
    </br>
    <?php endforeach ?>
    <a class="h-card u-url u-uid p-name">Frederik Niedernolte</a>
  </div>

</main>
<?php snippet('footer') ?>