blades 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3f7954e3b9977808390bbebe13bdf1596a538efd9354806c55209b0da6442b7e
4
+ data.tar.gz: 5573dcddcfa9b69019ebdbae84a3c1757ffc80f58e027130971c56f805992bd5
5
+ SHA512:
6
+ metadata.gz: cc13e4fec860da29fa0bf9a05a16284abf0dca054c34aa590042dad8eab64577dd0ebc258eff51afc3186a9a9c7e7015cf8c602b3797a53b7d725c2a2d8033f7
7
+ data.tar.gz: c4383edfad037e4133b91c3f15e1953c62e1420cc387bb49e9560ad4124b698e15005e0ef53e9feb2dba08796c138d0b8e75c58ff034ed5f2e00e3ad20c1c89e
@@ -0,0 +1,49 @@
1
+ {% comment %}<!--section:code-->```liquid{% endcomment %}
2
+ <!doctype html>
3
+ <html lang="{{ site.lang | default: 'en' }}">
4
+ <head>
5
+ <meta charset="utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
7
+ <link rel="icon" href="{{ site.favicon | default: '/favicon.svg' }}">
8
+ {% if site.favicon_alt %}
9
+ <link rel="alternate icon" href="{{ site.favicon_alt }}" type="image/png">
10
+ {% endif %}
11
+ <title>
12
+ {%- if title %}{{ title | strip_html | append: ' | ' }}{% endif -%}
13
+ {{- site.title -}}
14
+ </title>
15
+ <meta name="description" content="{{ description | strip_html }}">
16
+
17
+ {%- for href in site.styles %}
18
+ <link rel="stylesheet" href="{{ href | relative_url }}">
19
+ {%- endfor %}
20
+ <style>
21
+ {{ site.inline_styles | join: '\n' }}
22
+ </style>
23
+
24
+ {%- for src in site.scripts %}
25
+ <script src="{{ src }}" defer></script>
26
+ {%- endfor %}
27
+ <script type="module">
28
+ {{ site.inline_scripts | join: '\n' }}
29
+ </script>
30
+
31
+ {{ content_for_header }}
32
+ </head>
33
+
34
+ <body>
35
+ {{ body }}
36
+ </body>
37
+ </html>
38
+ {% comment %}```
39
+ <!--section:docs-->
40
+ Usage in Liquid layout:
41
+
42
+ ```liquid
43
+ {% capture body %}...{% endcapture %}
44
+
45
+ {% include blades/html.liquid %}
46
+ ```
47
+
48
+ Living example: https://github.com/anyblades/bladeswitch/blob/main/_includes/default.liquid
49
+ <!--section-->{% endcomment %}
@@ -0,0 +1,52 @@
1
+ {# <!--section:code-->```jinja2 #}
2
+ <!doctype html>
3
+ <html lang="{{ site.lang | d('en') }}">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover" />
7
+ <link rel="icon" href="{{ site.favicon | d('/favicon.svg') }}" />
8
+ {% if site.favicon_alt %}
9
+ <link rel="alternate icon" href="{{ site.favicon_alt }}" type="image/png" />
10
+ {% endif %}
11
+ <title>
12
+ {{- title | string | striptags ~ ' | ' if title -}}
13
+ {{- site.title -}}
14
+ </title>
15
+ <meta name="description" content="{{ description | striptags }}" />
16
+
17
+ {%- for href in site.styles %}
18
+ <link rel="stylesheet" href="{{ href }}" />
19
+ {%- endfor %}
20
+ {# prettier-ignore-start #}<style>
21
+ {{ site.inline_styles | d([]) | join('\n') | safe }}
22
+ </style>{# prettier-ignore-end #}
23
+
24
+ {%- for src in site.scripts %}
25
+ <script src="{{ src }}" defer></script>
26
+ {%- endfor %}
27
+ {# prettier-ignore-start #}<script type="module">
28
+ {{ site.inline_scripts | d([]) | join('\n') | safe }}
29
+ </script>{# prettier-ignore-end #}
30
+
31
+ {{ content_for_header | safe }}
32
+ </head>
33
+
34
+ <body>
35
+ {% block body %}
36
+ {% endblock %}
37
+ </body>
38
+ </html>
39
+ {#```
40
+ - `title | string` avoids error with `| striptags` when you pass a pure number.
41
+
42
+ <!--section:docs-->
43
+ Usage in Nunjucks layout:
44
+
45
+ ```jinja2
46
+ {% extends 'blades/html.njk' %}
47
+
48
+ {% block body %}...{% endblock %}
49
+ ```
50
+
51
+ Living example: https://github.com/anyblades/build-awesome-starter/blob/main/_includes/default.njk
52
+ <!--section--> #}
@@ -0,0 +1,52 @@
1
+ {# <!--section:code-->```twig #}
2
+ <!doctype html>
3
+ <html lang="{{ site.lang|default('en') }}">
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover" />
7
+ <link rel="icon" href="{{ site.favicon|default('/favicon.svg') }}" />
8
+ {% if site.favicon_alt %}
9
+ <link rel="alternate icon" href="{{ site.favicon_alt }}" type="image/png" />
10
+ {% endif %}
11
+ <title>
12
+ {{- title ? title|striptags ~ ' | ' -}}
13
+ {{- site.title -}}
14
+ </title>
15
+ <meta name="description" content="{{ description|striptags }}" />
16
+
17
+ {%- for href in site.styles %}
18
+ <link rel="stylesheet" href="{{ href }}" />
19
+ {%- endfor %}
20
+ <style>
21
+ {{ site.inline_styles|default([])|join('\n')|raw }}
22
+ </style>
23
+
24
+ {%- for src in site.scripts %}
25
+ <script src="{{ src }}" defer></script>
26
+ {%- endfor %}
27
+ <script type="module">
28
+ {{ site.inline_scripts|default([])|join('\n')|raw }}
29
+ </script>
30
+
31
+ {{ content_for_header|default('')|raw }}
32
+ </head>
33
+
34
+ <body>
35
+ {% block body %}
36
+ {% endblock %}
37
+ </body>
38
+ </html>
39
+ {#```
40
+ - `title ? …` renders the prefix only when a title is set, mirroring the Nunjucks `if title` guard.
41
+
42
+ <!--section:docs-->
43
+ Usage in Twig layout:
44
+
45
+ ```twig
46
+ {% extends 'blades/html.twig' %}
47
+
48
+ {% block body %}...{% endblock %}
49
+ ```
50
+
51
+ Pass `site`, `title` and `description` via the render context.
52
+ <!--section--> #}
@@ -0,0 +1,21 @@
1
+ {% comment %}<!--section:code-->```liquid{% endcomment %}
2
+ <ul>
3
+ {%- for link in links %}
4
+ <li>
5
+ {% # prettier-ignore %}
6
+ <a href="{{ link.url }}" {% if link.url == current_url %}aria-current="page"{% endif %}>
7
+ {{- link.title -}}
8
+ </a>
9
+ </li>
10
+ {%- endfor %}
11
+ </ul>
12
+ {% # prettier-ignore %}
13
+ {% comment %}```
14
+ <!--section:docs-->
15
+ Usage example for https://www.11ty.dev/docs/plugins/navigation/#bring-your-own-html-render-the-menu-items-manually:
16
+
17
+ ```liquid
18
+ {% assign links = collections.all | eleventyNavigation %}
19
+ {% render blades/links, links: links, current_url: page.url %}
20
+ ```
21
+ <!--section-->{% endcomment %}
@@ -0,0 +1,18 @@
1
+ {# <!--section:code-->```twig #}
2
+ <ul>
3
+ {%- for link in links %}
4
+ <li>
5
+ <a href="{{ link.url }}" {% if link.url == current_url %}aria-current="page"{% endif %}>
6
+ {{- link.title -}}
7
+ </a>
8
+ </li>
9
+ {%- endfor %}
10
+ </ul>
11
+ {#```
12
+ <!--section:docs-->
13
+ Pass the links and the current URL explicitly so nothing else leaks into scope:
14
+
15
+ ```twig
16
+ {% include 'blades/links.twig' with { links: menu, current_url: app.request.pathInfo } only %}
17
+ ```
18
+ <!--section--> #}
@@ -0,0 +1,25 @@
1
+ {#- Based on https://github.com/11ty/eleventy-base-blog/blob/main/content/sitemap.xml.njk
2
+ <!--section:code-->```jinja2 -#}<?xml
3
+ version="1.0" encoding="utf-8"?>
4
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
5
+ {%- for page in collections.all %}
6
+ {% if page.data.permalink != false %}
7
+ <url>
8
+ <loc>{{ site.base }}{{ page.url }}</loc>
9
+ <lastmod>{{ page.date | date }}</lastmod>
10
+ </url>
11
+ {% endif %}
12
+ {%- endfor %}
13
+ </urlset>
14
+ {#```
15
+ <!--section:docs-->
16
+ Usage example for https://github.com/11ty/eleventy-plugin-rss:
17
+ ```jinja2 {data-caption=sitemap.xml.njk}
18
+ ---
19
+ permalink: /sitemap.xml
20
+ layout: false
21
+ eleventyExcludeFromCollections: true
22
+ ---
23
+ {% include 'blades/sitemap.xml.njk' %}
24
+ ```
25
+ <!--section--> #}
@@ -0,0 +1,23 @@
1
+ {#- Based on https://github.com/11ty/eleventy-base-blog/blob/main/content/sitemap.xml.njk
2
+ <!--section:code-->```twig -#}
3
+ <?xml version="1.0" encoding="utf-8"?>
4
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
5
+ {%- for page in collections.all %}
6
+ {% if page.data.permalink != false %}
7
+ <url>
8
+ <loc>{{ site.base }}{{ page.url }}</loc>
9
+ <lastmod>{{ page.date|date('c') }}</lastmod>
10
+ </url>
11
+ {% endif %}
12
+ {%- endfor %}
13
+ </urlset>
14
+ {#```
15
+ <!--section:docs-->
16
+ Render from a standalone route/template that outputs `application/xml`:
17
+
18
+ ```twig
19
+ {% include 'blades/sitemap.xml.twig' %}
20
+ ```
21
+
22
+ `date('c')` emits an ISO-8601 `lastmod`, which is what the sitemap spec expects.
23
+ <!--section--> #}