kristoff-it / zine

Fast, Scalable, Flexible Static Site Generator (SSG)
https://zine-ssg.io
519 stars 24 forks source link

Links to RSS feeds #52

Open MasonRemaley opened 1 week ago

MasonRemaley commented 1 week ago

I tried to create a link to the RSS feed of a devlog on that devlog via this smd:

[link](index.xml)

But I got this output:

An asset referenced in a content file is missing. 

[missing_asset] unable to find 'index.xml'
(log.smd) content/log.smd:17:1: 
    [link](index.xml)
    ^^^^^^^^^^^^^^^^

I'm guessing some logic just needs to be added to the path checker to handle this case (but if there's just some other syntax I'm missing let me know!)

For anyone who finds this issue looking for a workaround, you can bypass the validation when needed by making the link with embedded HTML:

```=html
<a href="index.xml">link</a>
fabioarnold commented 4 days ago

According to the docs you can use:

<ctx alt="$page.alternative('rss')">
  <a href="$ctx.alt.link()" 
     type="$ctx.alt.type" 
     text="$ctx.alt.name"
  ></a>
</ctx>

(but it doesn't currently work for me 😅)

Edit: sorry, I totally missed that you were using SuperMD instead of SuperHTML.

fabioarnold commented 4 days ago

After a discussion on Discord here's what worked for me now:

    <ctx :loop="$page.alternatives">
      <ctx :if="$loop.it.name.eql('rss')">
        <a href="$loop.it.output" type="$loop.it.type">RSS</a>
      </ctx>
    </ctx>
.alternatives = [{
  .name = "rss",
  .type = "application/rss+xml",
  .layout = "blog.xml",
  .output = "index.xml",
}],