Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow rendering subpages #101

Open
MFAshby opened this issue Dec 21, 2024 · 0 comments
Open

Allow rendering subpages #101

MFAshby opened this issue Dec 21, 2024 · 0 comments

Comments

@MFAshby
Copy link
Contributor

MFAshby commented Dec 21, 2024

Use case: I want to generate an RSS feed with the full content of my posts embedded in the RSS XML file. Here is my superhtml template:

<rss version="2.0" 
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Home on mfashby.net</title>
    <link>https://mfashby.net/</link>
    <description>Recent content in Home on mfashby.net</description>
    <language>en-gb</language>
    <lastBuildDate>Sun, 03 Mar 2024 19:31:27 +0000</lastBuildDate>
    <atom:link href="https://mfashby.net/index.xml" rel="self" type="application/rss+xml"/>
    <item :loop="$page.subpages()">
      <title :text="$loop.it.title"></title>
      <link :text="$loop.it.link()"></link>
      <pubDate :text="$loop.it.date.formatHTTP()"></pubDate>
      <guid isPermaLink="true" :text="$loop.it.link()"></guid>
      <description :text="$loop.it.description"></description>
      <content:encoded :html="$loop.it.content()"></content:encoded> 
    </item>
  </channel>
</rss>

However if I try to use this, I get the following error which indicates what I want to do is unsupported:

---------- SCRIPT RESULT TYPE MISMATCH ----------
A script evaluated to an unexpected type.

This attribute expects to evaluate to one
of the following types:
   - string
   - int

[script_eval_not_string_or_int]
(rss.xml) /home/martin/dev/mfashby.net/layouts/rss.xml:16:23:
    <content:encoded :html="$loop.it.content()"></content:encoded>
                     ^^^^^

note: value was generated from this sub-expression:
(rss.xml) /home/martin/dev/mfashby.net/layouts/rss.xml:16:39:
    <content:encoded :html="$loop.it.content()"></content:encoded>
                                     ^^^^^^^
Scripty evaluated to type: err
Error message: 'only the main page can be rendered for now, sorry!'

trace:
    layout `rss.xml`,
    content `posts/index.smd`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant