summaryrefslogtreecommitdiff
path: root/src/components/templates/licenses/WTFPL.astro
blob: d3546c7935a6d0904e636f3c6b03a2da22698188 (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
---
import { listYearsWithRanges } from "@utils/datetime";
import type { Props as BaseProps } from "../CopyrightNotice.astro";
interface Props extends BaseProps {}

const { years, holders } = Astro.props;
const firstYear = Math.min(...years);
const lastYears = years.sort((a, b) => a - b).slice(1);
---

<footer itemprop="copyrightNotice">
  <p>
    <small>
      Copyright © <span itemprop="copyrightYear">{firstYear}</span>, {
        listYearsWithRanges(lastYears, {
          list: { type: "unit", style: "narrow" },
          locale: "en",
        }).replace(/^\d+/, "")
      }

      {
        holders.map(({ name, url, email }) => {
          if (name === undefined) return undefined;

          const website = url?.[0];

          return (
          <span
            itemprop="copyrightHolder"
            itemscope
            itemtype="https://schema.org/Person"
          >{
              website !== undefined ? (
                <a
                  itemprop="url"
                  rel="author external noreferrer"
                  target="_blank"
                  href={website}
                  content={website}
                ><span itemprop="name">{name}</span></a>
              ) : <span itemprop="name">{name}</span>
            }
            {
              email !== undefined && (
                <>&lt;<a
                    itemprop="email"
                    rel="author external noreferrer"
                    target="_blank"
                    href={`mailto:${email}`}
                  >{email}</a>&gt;</>
              )
            }</span>
        );
        })
      }
    </small>
  </p>
  <p>
    <small>
      This work is free. You can redistribute it and/or modify it under the
      terms of the Do What The Fuck You Want To Public License, Version 2, as
      published by Sam Hocevar. See <a
        itemprop="license"
        href="http://www.wtfpl.net/"
        rel="license noreferrer"
        target="_blank"
      >http://www.wtfpl.net/</a> for more details.
    </small>
  </p>
</footer>