aboutsummaryrefslogtreecommitdiff
path: root/static/yap/theme.xsl
blob: 44e679b7b87111d39cc54d96871f406cebbc528b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">

    <html>

      <head>

        <meta charset="utf-8" />
        <meta name="theme-color" content="#ffffff" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />

        <title>Microblog - Mitja Felicijan</title>
        <link rel="icon" type="image/gif" href="/general/favicon.gif" />

        <link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet" />

        <style>
          .container-blog {
            max-width: 700px;
          }
        </style>

        <script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
        <script>
          window.addEventListener('load', () => {
            document.querySelectorAll('time').forEach(el => {
              const formattedDate = dayjs(el.getAttribute('datetime')).format('dddd, MMMM D, YYYY h:mm A');
              el.innerText = formattedDate;
            });
          });
        </script>

        <!--
          Examples:

          <item>
            <guid>1</guid>
            <title>Example of Image post</title>
            <pubDate>Wed, 02 Oct 2002 08:00:00 EST</pubDate>
            <enclosure url="https://placeimg.com/550/300/tech" />
          </item>
          <item>
            <title>Example of Text post</title>
            <pubDate>Wed, 02 Oct 2002 08:00:00 EST</pubDate>
          </item>
        -->

      </head>

      <body>

        <header class="container-blog mx-auto px-6 md:p-0">
          <div class="flex py-4 mt-4 mb-6 items-center gap-2">
            <h1>
              <a href="/" class="text-xl font-bold hover:bg-yellow-100">
                <xsl:value-of select="rss/channel/pageTitle" />
              </a>
            </h1>
          </div>
        </header>

        <main class="container-blog mx-auto px-6 md:p-0 mb-32">

          <xsl:for-each select="rss/channel/item">
            <xsl:sort select="guid" data-type="number" order="descending" />

            <article class="flex flex-col md:flex-row gap-4 mb-10">

              <xsl:if test="enclosure/@url">
                <a class="w-full md:w-80" target="_blank">
                  <xsl:attribute name="href">
                    <xsl:value-of select="enclosure/@url" />
                  </xsl:attribute>

                  <img class="rounded w-full object-contain md:object-fill">
                    <xsl:attribute name="src">
                      <xsl:value-of select="enclosure/@url" />
                    </xsl:attribute>
                  </img>
                </a>
              </xsl:if>

              <section>
                <xsl:if test="pubDate">
                  <div class="text-gray-400 text-xs font-medium mb-1">
                    <time>
                      <xsl:attribute name="datetime">
                        <xsl:value-of select="pubDate" />
                      </xsl:attribute>
                      <xsl:value-of select="pubDate" />
                    </time>
                  </div>
                </xsl:if>

                <xsl:if test="title">
                  <div>
                    <xsl:value-of select="title" />
                  </div>
                </xsl:if>
              </section>

            </article>
          </xsl:for-each>

        </main>

      </body>
    </html>

  </xsl:template>
</xsl:stylesheet>