astro-accelerator 0.0.57 → 0.0.59

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": "0.0.57",
2
+ "version": "0.0.59",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -8,9 +8,10 @@ import Default from '@layouts/Default.astro';
8
8
  type Props = {
9
9
  frontmatter: Frontmatter
10
10
  headings: { depth: number; slug: string; text: string; }[];
11
+ breadcrumbs?: { url: string; title: string; ariaCurrent?: string; }[] | null;
11
12
  }
12
- const { frontmatter, headings } = Astro.props satisfies Props;
13
+ const { frontmatter, headings, breadcrumbs } = Astro.props satisfies Props;
13
14
  ---
14
- <Default frontmatter={ frontmatter } headings={ headings }>
15
+ <Default frontmatter={ frontmatter } headings={ headings } breadcrumbs={ breadcrumbs }>
15
16
  <slot />
16
17
  </Default>
@@ -27,8 +27,7 @@ const frontmatter: Frontmatter = {
27
27
  title: 'Articles',
28
28
  keywords: `articles`,
29
29
  description: `${SITE.title} articles.`,
30
- pubDate: pubDate,
31
- robots: 'noindex, follow'
30
+ pubDate: pubDate
32
31
  };
33
32
 
34
33
  // Language
@@ -30,8 +30,7 @@ const frontmatter: Frontmatter = {
30
30
  title: title,
31
31
  keywords: `${slug},articles`,
32
32
  description: `${SITE.title} ${slug} articles.`,
33
- pubDate: pubDate,
34
- robots: 'noindex, follow'
33
+ pubDate: pubDate
35
34
  };
36
35
 
37
36
  // Language
@@ -88,9 +87,22 @@ export async function getStaticPaths({ paginate }: any) {
88
87
 
89
88
  // Page Links
90
89
  const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
90
+
91
+ // Breadcrumbs
92
+ const breadcrumbs = [
93
+ {
94
+ url: pageLinks[0].url as string,
95
+ title: title,
96
+ },
97
+ {
98
+ url: page.url.current,
99
+ title: _(Translations.articles.page_title).replace('{n}', page.currentPage.toString()),
100
+ ariaCurrent: 'page',
101
+ }
102
+ ];
91
103
  ---
92
- <Default frontmatter={ frontmatter } headings={ headings }>
93
- <h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString())}</h2>
104
+ <Default frontmatter={ frontmatter } headings={ headings } breadcrumbs={ breadcrumbs }>
105
+ <h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString()) }</h2>
94
106
  <ArticleList lang={ lang } posts={ page.data } />
95
107
  <PagingLinks lang={ lang } page={ page } pageLinks={ pageLinks } />
96
108
  </Default>
@@ -30,8 +30,7 @@ const frontmatter: Frontmatter = {
30
30
  title: title,
31
31
  keywords: `${slug},articles`,
32
32
  description: `${SITE.title} ${slug} articles.`,
33
- pubDate: pubDate,
34
- robots: 'noindex, follow'
33
+ pubDate: pubDate
35
34
  };
36
35
 
37
36
  // Language
@@ -87,8 +86,21 @@ export async function getStaticPaths({ paginate }: any) {
87
86
 
88
87
  // Page Links
89
88
  const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
89
+
90
+ // Breadcrumbs
91
+ const breadcrumbs = [
92
+ {
93
+ url: pageLinks[0].url as string,
94
+ title: title,
95
+ },
96
+ {
97
+ url: page.url.current,
98
+ title: _(Translations.articles.page_title).replace('{n}', page.currentPage.toString()),
99
+ ariaCurrent: 'page',
100
+ }
101
+ ];
90
102
  ---
91
- <Default frontmatter={ frontmatter } headings={ headings }>
103
+ <Default frontmatter={ frontmatter } headings={ headings } breadcrumbs={ breadcrumbs }>
92
104
  <h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString())}</h2>
93
105
  <ArticleList lang={ lang } posts={ page.data } />
94
106
  <PagingLinks lang={ lang } page={ page } pageLinks={ pageLinks } />
@@ -9,8 +9,9 @@ type Props = {
9
9
  lang: string;
10
10
  frontmatter: Frontmatter
11
11
  headings: { depth: number; slug: string; text: string; }[];
12
+ breadcrumbs?: { url: string; title: string; ariaCurrent?: string; }[] | null;
12
13
  };
13
- const { lang } = Astro.props satisfies Props;
14
+ const { lang, breadcrumbs } = Astro.props satisfies Props;
14
15
 
15
16
  // Language
16
17
  const _ = Lang(lang);
@@ -20,6 +21,7 @@ const accelerator = new Accelerator(SITE);
20
21
 
21
22
  const currentUrl = new URL(Astro.request.url);
22
23
  const navPages = accelerator.navigation.breadcrumbs(currentUrl, SITE.subfolder);
24
+ let metaIndex = navPages.length;
23
25
  ---
24
26
  <nav class="site-breadcrumbs" aria-label={ _(Translations.aria.breadcrumbs) }>
25
27
  <ol vocab="http://schema.org/" typeof="BreadcrumbList">
@@ -29,5 +31,11 @@ const navPages = accelerator.navigation.breadcrumbs(currentUrl, SITE.subfolder);
29
31
  <a property="item" typeof="WebPage" href={ accelerator.urlFormatter.addSlashToAddress(page.url) } aria-current={ page.ariaCurrent } rel={ page.rel }><span property="name">{ page.title }</span></a>
30
32
  </li>
31
33
  ))}
34
+ {breadcrumbs && breadcrumbs.map( (crumb) => (
35
+ <li property="itemListElement" typeof="ListItem">
36
+ <meta property="position" content={ (metaIndex++).toString() } />
37
+ <a property="item" typeof="WebPage" href={ accelerator.urlFormatter.addSlashToAddress(crumb.url) } aria-current={ crumb.ariaCurrent }><span property="name">{ crumb.title }</span></a>
38
+ </li>
39
+ ))}
32
40
  </ol>
33
41
  </nav>
@@ -18,8 +18,9 @@ import Related from '@components/Related.astro';
18
18
  type Props = {
19
19
  frontmatter: Frontmatter
20
20
  headings: { depth: number; slug: string; text: string; }[];
21
+ breadcrumbs?: { url: string; title: string; ariaCurrent?: string; }[] | null;
21
22
  }
22
- const { frontmatter, headings } = Astro.props satisfies Props;
23
+ const { frontmatter, headings, breadcrumbs } = Astro.props satisfies Props;
23
24
 
24
25
  const lang = frontmatter.lang ?? SITE.default.lang;
25
26
  const textDirection = frontmatter.dir ?? SITE.default.dir;
@@ -44,7 +45,7 @@ const site_features = SITE.featureFlags;
44
45
  <body>
45
46
  <SkipLinks frontmatter={ frontmatter } headings={ headings } lang={ lang } />
46
47
  <Header frontmatter={ frontmatter } headings={ headings } lang={ lang } />
47
- <Breadcrumbs frontmatter={ frontmatter } headings={ headings } lang={ lang } />
48
+ <Breadcrumbs frontmatter={ frontmatter } headings={ headings } lang={ lang } breadcrumbs={ breadcrumbs } />
48
49
  <div class="content-group">
49
50
  <Navigation lang={ lang } />
50
51
  <main id="site-main">