My static website generator using poole https://www.xythobuz.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rss.xsl 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. # Pretty Feed
  4. Styles an RSS/Atom feed, making it friendly for humans viewers, and adds a link
  5. to aboutfeeds.com for new user onboarding. See it in action:
  6. https://interconnected.org/home/feed
  7. ## How to use
  8. 1. Download this XML stylesheet from the following URL and host it on your own
  9. domain (this is a limitation of XSL in browsers):
  10. https://github.com/genmon/aboutfeeds/blob/main/tools/pretty-feed-v3.xsl
  11. 2. Include the XSL at the top of the RSS/Atom feed, like:
  12. ```
  13. <?xml version="1.0" encoding="UTF-8"?>
  14. <?xml-stylesheet href="/PATH-TO-YOUR-STYLES/pretty-feed-v3.xsl" type="text/xsl"?>
  15. ```
  16. 3. Serve the feed with the following HTTP headers:
  17. ```
  18. Content-Type: application/xml; charset=utf-8 # not application/rss+xml
  19. x-content-type-options: nosniff
  20. ```
  21. (These headers are required to style feeds for users with Safari on iOS/Mac.)
  22. ## Limitations
  23. - Styling the feed *prevents* the browser from automatically opening a
  24. newsreader application. This is a trade off, but it's a benefit to new users
  25. who won't have a newsreader installed, and they are saved from seeing or
  26. downloaded obscure XML content. For existing newsreader users, they will know
  27. to copy-and-paste the feed URL, and they get the benefit of an in-browser feed
  28. preview.
  29. - Feed styling, for all browsers, is only available to site owners who control
  30. their own platform. The need to add both XML and HTTP headers makes this a
  31. limited solution.
  32. ## Credits
  33. pretty-feed is based on work by lepture.com:
  34. https://lepture.com/en/2019/rss-style-with-xsl
  35. This current version is maintained by aboutfeeds.com:
  36. https://github.com/genmon/aboutfeeds
  37. ## Feedback
  38. This file is in BETA. Please test and contribute to the discussion:
  39. https://github.com/genmon/aboutfeeds/issues/8
  40. -->
  41. <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  42. xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"
  43. xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
  44. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
  45. <xsl:template match="/">
  46. <html lang="en">
  47. <head>
  48. <meta charset="utf-8" />
  49. <title>RSS Feed - xythobuz.de</title>
  50. <meta name="description">
  51. <xsl:attribute name="content">
  52. <xsl:value-of select="/rss/channel/description" />
  53. </xsl:attribute>
  54. </meta>
  55. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  56. <link rel="author" href="xythobuz@xythobuz.de" />
  57. <link rel="shortcut icon" href="img/favicon.ico" />
  58. <link type="text/css" rel="stylesheet" href="css/style.css" />
  59. </head>
  60. <body>
  61. <div id="wrap"><div id="nav">
  62. <a>
  63. <xsl:attribute name="href">
  64. <xsl:value-of select="/rss/channel/link" />
  65. </xsl:attribute>
  66. <h1>
  67. <xsl:value-of select="/rss/channel/title" />
  68. - RSS Feed
  69. <img src="img/rss.png" />
  70. </h1>
  71. </a>
  72. </div></div>
  73. <div id="content">
  74. <p>
  75. This is the RSS feed for my blog.
  76. You can use it to get notified about new posts automatically.
  77. </p>
  78. <p>
  79. If you're already used to this and wondering why this looks strange, this is a styled RSS feed.
  80. Just copy the URL into your newsreader.
  81. </p>
  82. <p>
  83. If you don't know what RSS is check out <a href="https://aboutfeeds.com">About Feeds</a> to get started.
  84. </p>
  85. <h1>Recent Blog Posts</h1>
  86. <ul>
  87. <xsl:for-each select="/rss/channel/item">
  88. <li>
  89. <a>
  90. <xsl:attribute name="href">
  91. <xsl:value-of select="link" />
  92. </xsl:attribute>
  93. <xsl:value-of select="title" />
  94. </a>
  95. <br />
  96. <span class="listdesc">
  97. Published: <xsl:value-of select="substring(pubDate, 1, string-length(pubDate) - 15)" />
  98. </span>
  99. <br />
  100. <span class="listdesc">
  101. Updated: <xsl:value-of select="substring(atom:updated, 1, string-length(atom:updated) - 15)" />
  102. </span>
  103. </li>
  104. </xsl:for-each>
  105. </ul>
  106. <p>
  107. Last rebuild at: <xsl:value-of select="substring(/rss/channel/lastBuildDate, 1, string-length(/rss/channel/lastBuildDate) - 6)" />
  108. </p>
  109. <p>
  110. Styled RSS feed inspired by <a href="https://darekkay.com/blog/rss-styling/">Darek Kay</a> and <a href="https://github.com/genmon/aboutfeeds/blob/main/tools/pretty-feed-v3.xsl">pretty-feed-v3</a>.
  111. </p>
  112. </div>
  113. </body>
  114. </html>
  115. </xsl:template>
  116. </xsl:stylesheet>