fenton-jekyll-boilerplate 0.0.13 → 0.0.15

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: 24baa59c2c4906b3070f0707dfd96b27e6dec1b249b4450b285b8ddd04bafde2
4
- data.tar.gz: '059859afc1cd21a7c046d135001ffc391e2d80baf6be2f095eab46a7abf09189'
3
+ metadata.gz: 11581973bf7e6ca7aef4afabb61f30fc637fe23a25ce4915237530770c28b6a1
4
+ data.tar.gz: cc5759349dfa4bd0af02200b01836181a119081470c11dc762ca8fbada6d0030
5
5
  SHA512:
6
- metadata.gz: b55521d33500ad548a419fb85bec040fbf100a57b4350a25970a3cba0e61b2008fc93e65a733e9e9b69ee4bd9f502a275c7d7655914149180133650be3156b9c
7
- data.tar.gz: 151e8c5a96bfa7ab6be798dbcc3a835b1b697bdce4365b218dd28ea8aab4284791674721f3b7c02103cf0b49540d4e2e6ca23e78be75721c83e8cc3da2b502f0
6
+ metadata.gz: bd76c0783fd77ba3574ff1d4d098f47922157570d9a87a09065ebac17b61d06ff5248275c134c618ffc0a404219e79baa38cd4d9e6f964af1354223f3001603c
7
+ data.tar.gz: e0aa8f8672db795f8cd2366fc5c56a446cc691c27136927234400e228ce67633d6f78815c1b235da7511fd0e212b969988ca96d5670cf07c3aede886bb535a31
@@ -1,3 +1,3 @@
1
- <script>
2
- // Analytics scripts
3
- </script>
1
+ {%- if site.analytics_script -%}
2
+ {{ site.analytics_script }}
3
+ {%- endif -%}
@@ -1,22 +1,19 @@
1
1
  {%- assign current_url = page.url | remove: 'index.html' %}
2
- <nav class="site-breadcrumbs" aria-label="{{ 'aria' | t: 'breadcrumbs' }}">
3
- <ol vocab="http://schema.org/" typeof="BreadcrumbList">
4
- {%- for crumb in breadcrumbs %}
5
- {%- if forloop.last %}
2
+ {%- assign aria_current = '' %}
3
+ <nav class="site-breadcrumbs" aria-label="{{ 'aria' | t: 'breadcrumbs' }}">
4
+ <ol vocab="http://schema.org/" typeof="BreadcrumbList">
5
+ {%- for crumb in breadcrumbs %}
6
+ {%- if forloop.last %}
7
+ {%- assign aria_current = ' aria-current="page"' %}
8
+ {%- else %}
9
+ {%- assign aria_current = '' %}
10
+ {%- endif %}
6
11
  <li property="itemListElement" typeof="ListItem">
7
- <a property="item" typeof="WebPage" href="{{ crumb.url | relative_url }}" aria-current="page">
12
+ <a property="item" typeof="WebPage" href="{{ crumb.url | relative_url }}"{{aria_current}}>
8
13
  <span property="name">{{ crumb.title }}</span>
9
14
  <meta property="position" content="{{ crumb.position }}" />
10
15
  </a>
11
16
  </li>
12
- {%- else %}
13
- <li property="itemListElement" typeof="ListItem">
14
- <a property="item" typeof="WebPage" href="{{ crumb.url | relative_url }}">
15
- <span property="name">{{ crumb.title }}</span>
16
- <meta property="position" content="{{ crumb.position }}" />
17
- </a>
18
- </li>
19
- {%- endif %}
20
- {%- endfor %}
21
- </ol>
17
+ {%- endfor %}
18
+ </ol>
22
19
  </nav>
data/_includes/head.html CHANGED
@@ -5,9 +5,9 @@
5
5
  <meta name="description" content="{{ page.description }}">
6
6
  <meta name="keywords" content="{{ page.keywords }}">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <meta name="theme-color" content="#{{ site.theme_color_hex }}" />
9
- <meta name="msapplication-navbutton-color" content="#{{site.theme_color_hex}}" />
10
- <meta name="apple-mobile-web-app-status-bar-style" content="#{{site.theme_color_hex}}" />
8
+ <meta name="theme-color" content="#{{ site.theme_color_hex | default: 333333 }}" />
9
+ <meta name="msapplication-navbutton-color" content="#{{ site.theme_color_hex | default: 333333 }}" />
10
+ <meta name="apple-mobile-web-app-status-bar-style" content="#{{ site.theme_color_hex | default: 333333 }}" />
11
11
  <meta property="og:title" content="{{ page.title }}" />
12
12
  <meta property="og:url" content="{{ site.url }}{{ site.baseurl }}{{ page.url | replace:'index.html',''}}" />
13
13
  <meta property="og:type" content="website" />
@@ -1,51 +1,62 @@
1
+ {%- assign current_url = page.url | remove: 'index.html' %}
2
+ {%- assign previous = null %}
3
+ {%- assign page_num_regex = '/' | append: site.paginate_page | append: '[0-9]/' %}
4
+ {%- assign main_pages = site.pages | where: 'nav-level', '1' | sort: 'nav-order' %}
1
5
  <nav class="site-nav" id="site-nav" aria-label="{{ 'aria' | t: 'site_navigation' }}">
2
6
  <h2 class="site-nav-title">{{ 'navigation' | t: 'title' }}</h2>
3
7
  <ul>
4
- {%- assign current_url = page.url | remove: 'index.html' %}
5
- {%- assign previous = null %}
6
- {%- assign regex = '/' | append: site.paginate_page | append: '[0-9]/' %}
7
- {%- assign main_pages = site.pages | where: 'nav-level', '1' | sort: 'nav-order' -%}
8
- {% for item in main_pages %}
8
+ {%- for item in main_pages %}
9
9
  {%- assign current = item.nav-title | default: item.title %}
10
- {%- if (current != previous) %}
11
- {%- assign previous = item.nav-title | default: item.title %}
12
10
 
13
- {%- assign parent_perma = item.permalink %}
14
- {%- assign parent_perma_size = parent_perma | size %}
15
- {%- assign sub_pages = '' | split: '' %}
11
+ {%- comment %}Paging can introduce duplicates{% endcomment %}
12
+ {%- if current == previous %}
13
+ {%- continue %}
14
+ {%- endif %}
16
15
 
17
- {%- for p in site.pages %}
18
- {%- assign child_perma = p.permalink %}
19
- {%- assign child_perma_truncated = child_perma | truncate: parent_perma_size, '' %}
16
+ {%- comment %}Hierarchy and selected items are determined based on URL{% endcomment %}
17
+ {%- assign previous = item.nav-title | default: item.title %}
18
+ {%- assign parent_perma = item.permalink %}
19
+ {%- assign parent_perma_size = parent_perma | size %}
20
+ {%- assign sub_pages = '' | split: '' %}
21
+ {%- assign current_url_truncated = current_url | truncate: parent_perma_size, '' %}
22
+
23
+ {%- comment %}Find matching child pages by path{% endcomment %}
24
+ {%- for potential_sub_page in site.pages %}
25
+ {%- assign child_perma = potential_sub_page.permalink %}
26
+ {%- assign child_perma_truncated = child_perma | truncate: parent_perma_size, '' %}
20
27
 
21
- {%- if p.nav-level != 0 and parent_perma != '/' and child_perma_truncated == parent_perma and child_perma != parent_perma %}
22
- {%- assign sub_pages = sub_pages | push: p %}
23
- {%- endif %}
24
- {%- endfor %}
28
+ {%- if potential_sub_page.nav-level != 0 and parent_perma != '/' and child_perma_truncated == parent_perma and child_perma != parent_perma %}
29
+ {%- assign sub_pages = sub_pages | push: potential_sub_page %}
30
+ {%- endif %}
31
+ {%- endfor %}
25
32
 
26
33
  <li{%- if sub_pages.size > 0 %} class="has-children"{% endif %}>
27
- {%- assign item_url = item.url | regex_replace: regex,'/' | prepend: site.baseurl %}
28
- {%- if sub_pages.size > 0 %}
29
- <details class="sub-nav">
34
+ {%- assign item_url = item.url | regex_replace: page_num_regex,'/' | prepend: site.baseurl %}
35
+
36
+ {%- comment %}Details added if child pages exist{% endcomment %}
37
+ {%- if sub_pages.size > 0 %}
38
+ <details class="sub-nav"{% if current_url_truncated == parent_perma %} open="open"{% endif %}>
30
39
  <summary><span>{{ item.nav-section | default: item.nav-title | default: item.title }}</span></summary>
31
- {%- else %}
40
+ {%- else %}
32
41
  <a href="{{ item_url }}"{% if item_url == current_url) %} class="current-item" aria-current="page"{% endif %}>{{ item.nav-title | default: item.title }}</a>
33
- {%- endif -%}
34
- {% if sub_pages.size > 0 %}
42
+ {%- endif -%}
43
+
44
+ {%- comment %}Child pages list, parent injected as first item{% endcomment %}
45
+ {%- assign sub_pages_sorted = sub_pages | sort: 'nav-order' %}
46
+ {% if sub_pages.size > 0 %}
35
47
  <ul>
36
48
  <li>
37
49
  <a href="{{ item_url }}"{% if item_url == current_url) %} class="current-item" aria-current="page"{% endif %}>{{ item.nav-title | default: item.title }}</a>
38
50
  </li>
39
- {%- for child in sub_pages | sort: 'nav-order' %}
51
+ {%- for child in sub_pages_sorted %}
40
52
  <li>
41
53
  <a href="{{ child.url | prepend: site.baseurl }}"{% if child.url == current_url) %} class="current-item" aria-current="page"{% endif %}>{{ child.nav-title | default: child.title }}</a>
42
54
  </li>
43
- {%- endfor %}
55
+ {%- endfor %}
44
56
  </ul>
45
57
  </details>
46
- {%- endif %}
58
+ {%- endif %}
47
59
  </li>
48
- {%- endif %}
49
60
  {%- endfor %}
50
61
  </ul>
51
62
  </nav>
data/_layouts/post.html CHANGED
@@ -7,7 +7,7 @@ layout: default
7
7
  <h1>{{ page.title }}</h1>
8
8
  </header>
9
9
  <div class="post-meta">
10
- {%- assign date_format = site.date_format | default: "%b %-d, %Y" -%}
10
+ {%- assign date_format = site.date_format | default: '%b %-d, %Y' -%}
11
11
  {%- assign authordata = '' | split:'@' %}
12
12
  {%- for author in site.authors %}
13
13
  {%- if page.authors contains author.username or author.username == page.authors %}
data/_layouts/search.html CHANGED
@@ -7,12 +7,12 @@ layout: default
7
7
  </header>
8
8
  <div>
9
9
  {{ content }}
10
- <form method="GET" action="{{ site.search_fallback_url }}" role="search" id="site-search" class="site-search note" autocomplete="off">
10
+ <form method="GET" action="{{ site.search_fallback_url | default: 'https://www.google.com/search' }}" role="search" id="site-search" class="site-search note" autocomplete="off">
11
11
  <fieldset>
12
- <input type="hidden" name="{{ site.search_fallback_site }}" value="{{ site.url | prepend: 'site:' }}" />
12
+ <input type="hidden" name="{{ site.search_fallback_site | default: 'q' }}" value="{{ site.url | prepend: 'site:' }}" />
13
13
  <div>
14
14
  <label for="site-search-query">{{ 'search' | t: 'search_for' }}</label>
15
- <input type="text" name="{{ site.search_fallback_query }}" id="site-search-query" autofocus="autofocus" />
15
+ <input type="text" name="{{ site.search_fallback_query | default: 'q' }}" id="site-search-query" autofocus="autofocus" />
16
16
  <button id="site-search-button" type="submit">{{ 'search' | t: 'submit' }}</button>
17
17
  </div>
18
18
  </fieldset>
data/assets/js/main.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // @ts-check
2
2
 
3
- import { setNavigationTree } from './modules/nav-expand.js';
4
3
  import { setClickableBlocks } from './modules/click-blocks.js';
5
4
  import { addResizedEvent } from './modules/resizing.js';
6
5
  import { addStickyNavigation } from './modules/nav-sticky.js';
@@ -8,11 +7,9 @@ import { addMobileNavigation } from './modules/nav-mobile.js';
8
7
  import { addIntersectionObserver } from './modules/animation.js';
9
8
  import { qsa } from './modules/query.js';
10
9
 
11
- setNavigationTree('details.sub-nav');
12
- setClickableBlocks();
13
-
14
10
  const resizedEventName = addResizedEvent();
15
11
 
12
+ setClickableBlocks();
16
13
  addStickyNavigation('.site-header', '.site-nav', '.site-nav > ul', resizedEventName);
17
14
  addMobileNavigation('.navigation-icon', '.site-nav', resizedEventName);
18
15
  addIntersectionObserver('.post-list .list-item, main img, main .note, main blockquote');
@@ -3,4 +3,4 @@ layout: null
3
3
  permalink: robots.txt
4
4
  ---
5
5
  Sitemap: {{ site.url }}{{ '/sitemap.xml' | prepend: site.baseurl }}
6
- {{ site.robots_txt }}
6
+ {{ site.robots_txt | default: 'User-agent: *' }}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fenton-jekyll-boilerplate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Fenton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-15 00:00:00.000000000 Z
11
+ date: 2022-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -75,7 +75,6 @@ files:
75
75
  - assets/js/modules/click-blocks.js
76
76
  - assets/js/modules/events.js
77
77
  - assets/js/modules/focus.js
78
- - assets/js/modules/nav-expand.js
79
78
  - assets/js/modules/nav-mobile.js
80
79
  - assets/js/modules/nav-sticky.js
81
80
  - assets/js/modules/query.js
@@ -1,28 +0,0 @@
1
- // @ts-check
2
-
3
- import { qs, qsa } from './query.js';
4
-
5
- /**
6
- * Sets the navigation based on the current page
7
- *
8
- * Example: You have a navigation tree with an "About" page with several child items.
9
- * When the user is on the "About" page, or any child pages, the navigation should
10
- * be automatically expanded so the user can orient themselves within the site.
11
- *
12
- * @param {string} className
13
- */
14
- function setNavigationTree(className) {
15
- const site = document.location.origin;
16
- const location = document.location.pathname;
17
-
18
- qsa(className).forEach((summary) => {
19
- const anchorElement = /** @type {HTMLAnchorElement} */(qs('a', summary));
20
- const address = anchorElement.href.replace(site, '');
21
-
22
- if (location.startsWith(address)){
23
- summary.setAttribute('open', 'open');
24
- }
25
- });
26
- }
27
-
28
- export { setNavigationTree };