astro-accelerator 7.1.29 → 7.1.30

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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.1.29",
2
+ "version": "7.1.30",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -36,21 +36,21 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@astrojs/markdown-remark": "^7.3.1",
39
- "@astrojs/mdx": "^8.0.1",
40
- "@img/sharp-linux-x64": "^0.35.4",
41
- "astro": "^7.3.3",
39
+ "@astrojs/mdx": "^8.0.2",
40
+ "@img/sharp-linux-x64": "^0.35.5",
41
+ "astro": "^7.3.5",
42
42
  "astro-accelerator-utils": "^0.3.111",
43
- "csv": "^6.6.3",
43
+ "csv": "^6.6.4",
44
44
  "hast-util-from-selector": "^3.0.1",
45
45
  "html-to-text": "^10.0.1",
46
46
  "keyword-extractor": "^0.3.0",
47
47
  "optional": "^0.1.4",
48
48
  "remark-directive": "^4.0.0",
49
- "sharp": "^0.35.4"
49
+ "sharp": "^0.35.5"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@playwright/test": "^1.63.0",
53
- "cspell": "^10.3.3",
53
+ "cspell": "^10.3.5",
54
54
  "glob": "^13.0.6",
55
55
  "linkinator": "^8.1.0",
56
56
  "rimraf": "^6.1.3"
@@ -90,4 +90,4 @@
90
90
  "public/css/*",
91
91
  "public/js/*"
92
92
  ]
93
- }
93
+ }
@@ -38,6 +38,7 @@ type Article = {
38
38
  title: string;
39
39
  frontmatter: Record<string, any>;
40
40
  img: ImageInfo | null;
41
+ imageAlt: string;
41
42
  };
42
43
 
43
44
  const articles: Article[] = [];
@@ -47,9 +48,10 @@ for (let p of posts.filter(PostFiltering.isListable)) {
47
48
  url: p.url ?? "",
48
49
  title: await accelerator.markdown.getTextFrom(p.frontmatter?.title),
49
50
  frontmatter: p.frontmatter,
50
- img: p.frontmatter.bannerImage
51
+ img: p.frontmatter.bannerImage?.src
51
52
  ? getImageInfo(p.frontmatter.bannerImage.src, "", SITE.images.listerSize)
52
53
  : null,
54
+ imageAlt: p.frontmatter.bannerImage?.alt ?? "",
53
55
  };
54
56
 
55
57
  articles.push(item);
@@ -70,7 +72,7 @@ stats.stop();
70
72
  <li
71
73
  class="list-item"
72
74
  data-destination={accelerator.urlFormatter.formatAddress(post.url)}
73
- data-image={(post.frontmatter.bannerImage?.src.length > 0).toString()}>
75
+ data-image={Boolean(post.img).toString()}>
74
76
  <article>
75
77
  <div class="list-item-image">
76
78
  {post.img && (
@@ -78,7 +80,7 @@ stats.stop();
78
80
  srcset={post.img.srcset}
79
81
  sizes={post.img.sizes}
80
82
  src={post.img.src}
81
- alt={post.frontmatter.bannerImage.alt}
83
+ alt={post.imageAlt}
82
84
  class={post.img.class}
83
85
  width={post.img.metadata?.width}
84
86
  height={post.img.metadata?.height}
@@ -25,20 +25,25 @@ const _ = Lang(lang);
25
25
  const authorList = accelerator.authors.forPost(frontmatter);
26
26
 
27
27
  // Get image info
28
- const authorImage = authorList?.image?.src
28
+ const authorImage = authorList?.image?.src
29
29
  ? getImageInfo(authorList.image.src, 'author-image', SITE.images.authorSize)
30
30
  : null;
31
31
 
32
32
  const canonical = frontmatter.meta?.find(
33
33
  (meta) => meta.name.toLowerCase() === 'canonical',
34
34
  )?.content;
35
- const canonicalDomain = canonical ? new URL(canonical).hostname : undefined;
35
+ let canonicalDomain: string | undefined;
36
+ try {
37
+ canonicalDomain = canonical ? new URL(canonical).hostname : undefined;
38
+ } catch {
39
+ canonicalDomain = undefined;
40
+ }
36
41
 
37
42
  stats.stop();
38
43
  ---
39
- {authorList.writers.length > 0 &&
44
+ {authorList.writers.length > 0 &&
40
45
  <div class="post-meta">
41
- {authorImage &&
46
+ {authorImage &&
42
47
  <img
43
48
  srcset={ authorImage.srcset }
44
49
  sizes={ authorImage.sizes }
@@ -64,7 +69,7 @@ stats.stop();
64
69
  { _(Translations.post.last_modified) + ' ' + accelerator.dateFormatter.formatDate(frontmatter.modDate, lang) }
65
70
  </time>
66
71
  }
67
- {canonical &&
72
+ {canonicalDomain &&
68
73
  <br /><span set:html={ _(Translations.post.originally_published).replace('{link}', `<a href="${canonical}">${canonicalDomain}</a>`) }></span>
69
74
  }
70
75
  {authorList.mainAuthor &&
@@ -73,4 +78,4 @@ stats.stop();
73
78
  </div>
74
79
  </div>
75
80
  </div>
76
- }
81
+ }
@@ -37,7 +37,12 @@ const authorImage = authorList?.image?.src
37
37
  const canonical = frontmatter.meta?.find(
38
38
  (meta) => meta.name.toLowerCase() === "canonical",
39
39
  )?.content;
40
- const canonicalDomain = canonical ? new URL(canonical).hostname : undefined;
40
+ let canonicalDomain: string | undefined;
41
+ try {
42
+ canonicalDomain = canonical ? new URL(canonical).hostname : undefined;
43
+ } catch {
44
+ canonicalDomain = undefined;
45
+ }
41
46
 
42
47
  stats.stop();
43
48
  ---
@@ -87,7 +92,7 @@ stats.stop();
87
92
  )}
88
93
  />
89
94
  <ReadingTime lang={lang} frontmatter={frontmatter} />
90
- {canonical && (
95
+ {canonicalDomain && (
91
96
  <span
92
97
  class="originally-published"
93
98
  set:html={_(
@@ -26,7 +26,7 @@ const _ = Lang(lang);
26
26
  const currentUrl = new URL(Astro.request.url);
27
27
  const navPages = accelerator.navigation.breadcrumbs(currentUrl, SITE.subfolder, breadcrumbs?.length ?? 0);
28
28
 
29
- let metaIndex = navPages.length;
29
+ let metaIndex = navPages.length + 1;
30
30
 
31
31
  stats.stop();
32
32
  ---
@@ -36,7 +36,7 @@ stats.stop();
36
36
  {
37
37
  navPages.map((page, index) => (
38
38
  <li property="itemListElement" typeof="ListItem">
39
- <meta property="position" content={index.toString()} />
39
+ <meta property="position" content={(index + 1).toString()} />
40
40
  <a property="item" typeof="WebPage" href={accelerator.urlFormatter.formatAddress(page.url)} aria-current={page.ariaCurrent ? page.ariaCurrent : null} rel={page.rel}>
41
41
  <span property="name">{page.title}</span></a>
42
42
  </li>
@@ -36,7 +36,7 @@ stats.stop();
36
36
  <h2 class="site-nav-title">{_(Translations.navigation.title)}</h2>
37
37
  <ul>
38
38
  {
39
- pages
39
+ [...pages]
40
40
  .sort((a, b) => a.order - b.order)
41
41
  .map((page) => <NavigationItem lang={lang} page={page} />)
42
42
  }
@@ -35,7 +35,7 @@ stats.stop();
35
35
  <h2 class="site-nav-title">{_(Translations.navigation.title)}</h2>
36
36
  <ul>
37
37
  {
38
- pages
38
+ [...pages]
39
39
  .sort((a, b) => a.order - b.order)
40
40
  .map((page) => (
41
41
  <li>
@@ -33,7 +33,7 @@ stats.stop();
33
33
  <details class="sub-nav" open={ page.isOpen }>
34
34
  <summary><span>{ page.section }</span></summary>
35
35
  <ul>
36
- { page.children.sort((a, b) => a.order - b.order).map((page) => (
36
+ { [...page.children].sort((a, b) => a.order - b.order).map((page) => (
37
37
  <Astro.self lang={ lang } page={ page } />
38
38
  ))}
39
39
  </ul>
@@ -24,8 +24,9 @@ const accelerator = new Accelerator(SITE);
24
24
  {showSearch &&
25
25
  <form method="GET" action={SITE.search.fallbackUrl ?? "https://www.google.com/search"} role="search" autocomplete="off" data-sourcedata={SITE.subfolder + "/search.json"}>
26
26
  <fieldset>
27
- <input type="hidden" name={SITE.search.fallbackSite ?? "q"} value={"site:" + siteUrl} />
28
- <input type="text" name={SITE.search.fallbackSite ?? "q"} class="site-search-query" placeholder={_(Translations.search.search_for)} spellcheck="true" autocomplete="off" autofocus="autofocus" />
27
+ <input type="hidden" name={SITE.search.fallbackQuery ?? "q"} value={"site:" + siteUrl} />
28
+ <label class="visually-hidden" for="site-search-query">{_(Translations.search.search_for)}</label>
29
+ <input id="site-search-query" type="text" name={SITE.search.fallbackQuery ?? "q"} class="site-search-query" placeholder={_(Translations.search.search_for)} spellcheck="true" autocomplete="off" />
29
30
  <button type="submit" set:html={_(Translations.search.submit)}></button>
30
31
  </fieldset>
31
32
  </form>
@@ -39,13 +39,12 @@ stats.stop();
39
39
  autocomplete="off"
40
40
  data-sourcedata={SITE.subfolder + '/search.json'}>
41
41
  <fieldset>
42
- <input type="hidden" name={SITE.search.fallbackSite ?? 'q'} value={'site:' + siteUrl} />
42
+ <input type="hidden" name={SITE.search.fallbackQuery ?? 'q'} value={'site:' + siteUrl} />
43
43
  <div>
44
44
  <label for="site-search-query">{_(Translations.search.search_for)}</label>
45
45
  <input
46
- autofocus="autofocus"
47
46
  type="text"
48
- name={SITE.search.fallbackSite ?? 'q'}
47
+ name={SITE.search.fallbackQuery ?? 'q'}
49
48
  id="site-search-query"
50
49
  spellcheck="true"
51
50
  autocomplete="off"
File without changes
File without changes