jekyll-theme-amethyst 2.0.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f24ddb3ef8eea41aefe27157c649ee526fb88508a0500b40a4ae6be5ee2829e
4
- data.tar.gz: ffede56a7da05fce5c4681135f4e4c11b1e322d8b1fde377849262b0339d71b7
3
+ metadata.gz: b821452b60270650a16031ce0c02143e94cc397e8c99dd661318398d59576497
4
+ data.tar.gz: f23da2ecb2b942d07cdb71a96e2de9c30f3d2ad3506b4bc3ef1fa2548e59a04d
5
5
  SHA512:
6
- metadata.gz: 9a8681d0da13282f8ac0de2c56cfab79900c90360195f656b244f370145c0bb7c6934839294a7ba363155b60fed34bf60535e6c2e46716ec290e866d3056c2ab
7
- data.tar.gz: 8eb5fc49da1f95afa1f717ebc65f9c0bf168f9bbded302377ea2ece1ba53b0aba7008a5420cbb68f5922be13427bfc757ce82cff8fc0c4535dd630101cbb2477
6
+ metadata.gz: 7739a80aa0ad3174a480b5302b6d8510fc3c0d219dfcebb6cfe6d2ff958ee87e346972b97102c5bc1bf13cd89dea9ce6996fb65d84fa0c693a9e1ea64eb6f7d4
7
+ data.tar.gz: 5cb9d1535f2899914db53358d579b846b233c0853d6210ac76f52c3c2844b38bd0d6b14791700740c5af5e049d814ee20aadf906b342ff7a15fbf71f5f52460b
@@ -45,11 +45,16 @@
45
45
  {% endif %}
46
46
  <meta name="twitter:card" content="summary_large_image">
47
47
 
48
-
49
48
  {% if layout.amethyst.pagetype == "navigation" %}
50
49
  <meta name="robots" content="{{ page.amethyst.robots | default: layout.amethyst.robots | default: 'noindex,follow' }}">
51
50
  <meta name="docsearch:amethyst_pagetype_navigation" content="1">
52
51
  {% endif %}
53
52
 
53
+ {% if page.layout == "post" and page.date and page.author %}
54
+ <meta property="og:type" content="article">
55
+ <meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
56
+ <meta name="author" content="{{ site.data.authors[include.author] | default: include.author | escape }}">
57
+ {% endif %}
58
+
54
59
  {% endcapture -%}
55
60
  {{ opengraph | strip_newlines }}
@@ -4,3 +4,25 @@
4
4
  <input type="hidden" name="sites" value="{{ site.url | remove_first: 'http://' | remove_first: 'https://' }}">
5
5
  </form>
6
6
  </typesense-minibar>
7
+ {%- if jekyll.environment == "development" %}
8
+ <script type="module">
9
+ /* global Response, URL */
10
+ // Override URLs in search results to be relative to localhost,
11
+ // by replacing "https://production.example/path" with "/path",
12
+ // in any responses that look like they are from Typesense.
13
+ const parent = Response.prototype.json;
14
+ Response.prototype.json = function () {
15
+ return parent.call(this).then(function (obj) {
16
+ if (obj && obj.grouped_hits) {
17
+ for (const group of obj.grouped_hits) {
18
+ for (const hit of group.hits) {
19
+ const url = new URL(hit.document.url);
20
+ hit.document.url = url.pathname + url.hash;
21
+ }
22
+ }
23
+ }
24
+ return obj;
25
+ });
26
+ };
27
+ </script>
28
+ {%- endif %}
@@ -65,6 +65,8 @@ Block data:
65
65
  {%- assign block_contents = site.posts | slice: 0, 5 -%}
66
66
  {%- elsif block_type == "archive" -%}
67
67
  {%- assign block_contents = site.pages | where: "layout", "posts-year" | sort_natural: 'date' | reverse -%}
68
+ {%- assign group_page = site.pages | where: "layout", "posts-archive" | first -%}
69
+ {%- assign block_url = block.url | default: group_page.url -%}
68
70
  {%- elsif block_type == "tags" -%}
69
71
  {%- assign block_contents = site.pages | where: "layout", "posts-tag" | sort_natural: 'title' -%}
70
72
  {%- elsif block_type == "link" -%}
data/_layouts/post.html CHANGED
@@ -8,7 +8,12 @@ layout: wrapper
8
8
  <header>
9
9
  <h1>{{ page.title | escape }}</h1>
10
10
  {%- assign date_format = site.amethyst.date_format | default: "%e %B %Y" -%}
11
- <p class="post-meta byline">Posted on <a href="{{ page.url | relative_url }}" rel="bookmark"><time itemprop="pubdate" datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: date_format }}</time></a>{% if page.author %} by <span class="vcard"><span class="fn n" rel="author">{{ page.author | escape }}</span></span>{% endif %}</p>
11
+ <p class="post-meta byline">Posted on <a href="{{ page.url | relative_url }}" rel="bookmark"><time itemprop="pubdate" datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: date_format }}</time></a>{% if page.author %} by <span class="vcard"><span class="fn n" rel="author">
12
+ {%- assign author_page = site.pages | where: "layout", "posts-author" | where: "author", page.author | first -%}
13
+ {%- if author_page -%}
14
+ <a href="{{ author_page.url | relative_url }}">{{ site.data.authors[page.author] | default: page.author | escape }}</a>
15
+ {%- else -%}{{ site.data.authors[page.author] | default: page.author | escape}}
16
+ {%- endif -%}</span></span>{% endif %}</p>
12
17
  </header>
13
18
  {{ content }}
14
19
  </article>
@@ -12,7 +12,7 @@ amethyst:
12
12
  {%- for post in posts -%}
13
13
  <div class="post-row">
14
14
  <h2><a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a></h2>
15
- <p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ post.author | escape }}{% endif %}</p>
15
+ <p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ site.data.authors[include.author] | default: include.author | escape }}{% endif %}</p>
16
16
  <div class="post">
17
17
  {{- post.excerpt -}}
18
18
  {%- if post.excerpt != post.content %}
@@ -12,7 +12,7 @@ amethyst:
12
12
  {%- for post in posts -%}
13
13
  <div class="post-row">
14
14
  <h2><a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a></h2>
15
- <p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ post.author | escape }}{% endif %}</p>
15
+ <p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ site.data.authors[include.author] | default: include.author | escape }}{% endif %}</p>
16
16
  <div class="post">
17
17
  {{- post.excerpt -}}
18
18
  {%- if post.excerpt != post.content %}
data/_layouts/posts.html CHANGED
@@ -13,7 +13,7 @@ amethyst:
13
13
  {% for post in posts -%}
14
14
  <div class="post-row">
15
15
  <h2><a href="{{ post.url | relative_url }}">{{ post.title | escape }}</a></h2>
16
- <p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ post.author | escape }}{% endif %}</p>
16
+ <p class="post-meta">Posted on <time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date: date_format }}</time>{% if post.author %} by {{ site.data.authors[include.author] | default: include.author | escape }}{% endif %}</p>
17
17
  <div class="post">
18
18
  {{- post.excerpt -}}
19
19
  {%- if post.excerpt != post.content %}
@@ -1,4 +1,4 @@
1
- /*! https://github.com/jquery/typesense-minibar 1.3.2 */
1
+ /*! https://github.com/jquery/typesense-minibar 1.3.4 */
2
2
  .tsmb-form,
3
3
  typesense-minibar {
4
4
  --tsmb-size-edge: 1px;
@@ -24,6 +24,8 @@ typesense-minibar {
24
24
  --tsmb-color-primary30: #390f39;
25
25
  --tsmb-color-primary50: #9c3493;
26
26
  --tsmb-color-primary90: #fbdbfb;
27
+
28
+ max-width: 100%;
27
29
  }
28
30
 
29
31
  .tsmb-form,
@@ -88,7 +90,7 @@ typesense-minibar form::before {
88
90
  content: '';
89
91
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='654 -372 1664 1664' width='20' height='20'><path d='M1806,332c0-123.3-43.8-228.8-131.5-316.5C1586.8-72.2,1481.3-116,1358-116s-228.8,43.8-316.5,131.5 C953.8,103.2,910,208.7,910,332s43.8,228.8,131.5,316.5C1129.2,736.2,1234.7,780,1358,780s228.8-43.8,316.5-131.5 C1762.2,560.8,1806,455.3,1806,332z M2318,1164c0,34.7-12.7,64.7-38,90s-55.3,38-90,38c-36,0-66-12.7-90-38l-343-342 c-119.3,82.7-252.3,124-399,124c-95.3,0-186.5-18.5-273.5-55.5s-162-87-225-150s-113-138-150-225S654,427.3,654,332 s18.5-186.5,55.5-273.5s87-162,150-225s138-113,225-150S1262.7-372,1358-372s186.5,18.5,273.5,55.5s162,87,225,150s113,138,150,225 S2062,236.7,2062,332c0,146.7-41.3,279.7-124,399l343,343C2305.7,1098.7,2318,1128.7,2318,1164z'/></svg>") 0 50% / contain no-repeat;
90
92
  position: absolute;
91
- top: calc(var(--tsmb-size-sm) + var(--tsmb-size-edge));
93
+ top: calc(var(--tsmb-size-edge) + var(--tsmb-size-sm));
92
94
  left: var(--tsmb-size-sm);
93
95
  width: var(--tsmb-size-base);
94
96
  height: var(--tsmb-size-input);
@@ -104,7 +106,7 @@ typesense-minibar form::before {
104
106
  .tsmb-icon-close {
105
107
  box-sizing: border-box;
106
108
  position: absolute;
107
- top: calc(50% - var(--tsmb-size-base)/2);
109
+ top: calc(var(--tsmb-size-edge) + var(--tsmb-size-sm) + (var(--tsmb-size-input)/2) - (var(--tsmb-size-base)/2));
108
110
  right: var(--tsmb-size-base);
109
111
  width: var(--tsmb-size-base);
110
112
  height: var(--tsmb-size-base);
@@ -115,11 +117,7 @@ typesense-minibar form::before {
115
117
  cursor: pointer;
116
118
  }
117
119
 
118
- .tsmb-form--open .tsmb-icon-close {
119
- display: block !important;
120
- }
121
-
122
- .tsmb-form--slash::after {
120
+ form:not(.tsmb-form--open) .tsmb-icon-close {
123
121
  display: none;
124
122
  }
125
123
 
@@ -1,4 +1,4 @@
1
- /*! https://github.com/jquery/typesense-minibar 1.3.2 */
1
+ /*! https://github.com/jquery/typesense-minibar 1.3.4 */
2
2
  globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) {
3
3
  const cache = new Map();
4
4
  const state = { query: '', cursor: -1, open: false, hits: [] };
@@ -41,7 +41,6 @@ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) {
41
41
  const query = state.query = input.value;
42
42
  if (!query) {
43
43
  state.hits = [];
44
- state.cursor = -1;
45
44
  return close();
46
45
  }
47
46
  const hits = await search(query);
@@ -62,7 +61,10 @@ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) {
62
61
  if (!e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
63
62
  if (e.code === 'ArrowDown') moveCursor(1);
64
63
  if (e.code === 'ArrowUp') moveCursor(-1);
65
- if (e.code === 'Escape') close();
64
+ if (e.code === 'Escape') {
65
+ close();
66
+ input.blur();
67
+ }
66
68
  if (e.code === 'Enter') {
67
69
  const url = state.hits[state.cursor]?.url;
68
70
  if (url) location.href = url;
@@ -72,11 +74,12 @@ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) {
72
74
  form.addEventListener('submit', function (e) {
73
75
  e.preventDefault();
74
76
  });
75
- form.insertAdjacentHTML('beforeend', '<svg viewBox="0 0 12 12" width="20" height="20" aria-hidden="true" class="tsmb-icon-close" style="display: none;"><path d="M9 3L3 9M3 3L9 9"/></svg>');
77
+ form.insertAdjacentHTML('beforeend', '<svg viewBox="0 0 12 12" width="20" height="20" aria-hidden="true" tabindex="-1" class="tsmb-icon-close"><path d="M9 3L3 9M3 3L9 9"/></svg>');
76
78
  form.querySelector('.tsmb-icon-close').addEventListener('click', function () {
77
79
  input.value = '';
78
- input.focus();
80
+ state.hits = [];
79
81
  close();
82
+ input.focus();
80
83
  });
81
84
  connect();
82
85
 
@@ -117,7 +120,7 @@ globalThis.tsminibar = function tsminibar (form, dataset = form.dataset) {
117
120
  let hits = cache.get(query);
118
121
  if (hits) {
119
122
  cache.delete(query);
120
- cache.set(query, hits); // LRU
123
+ cache.set(query, hits);
121
124
  return hits;
122
125
  }
123
126
  searchParams.set('q', query);
@@ -37,3 +37,37 @@ module Jekyll
37
37
  end
38
38
 
39
39
  Liquid::Template.register_filter(Jekyll::AmethystFilters)
40
+
41
+ module AmethystPlugin
42
+
43
+ class AuthorPageWithoutAFile < Jekyll::PageWithoutAFile
44
+ def template
45
+ # The template of the permalink, can be customized e.g. to "/blog/author/:author/"
46
+ # for sites with both API docs and a blog.
47
+ site.config["amethyst"]["author_permalink"] || "/author/:author"
48
+ end
49
+
50
+ def url_placeholders
51
+ super.merge({
52
+ "author" => data["author"]
53
+ })
54
+ end
55
+ end
56
+
57
+ class AuthorPageGenerator < Jekyll::Generator
58
+ safe true
59
+
60
+ def generate(site)
61
+ site.data["authors"].each do |slug, name|
62
+ site.pages << AuthorPageWithoutAFile.new(site, site.source, 'author', "#{slug}.html").tap do |page|
63
+ page.data.merge!(
64
+ "layout" => "posts-author",
65
+ "title" => name,
66
+ "author" => slug
67
+ )
68
+ end
69
+ end
70
+ end
71
+ end
72
+
73
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-amethyst
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timo Tijhof