astro-accelerator 4.0.28 → 4.0.32

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": "4.0.28",
2
+ "version": "4.0.32",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -32,9 +32,9 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@astrojs/mdx": "^2.3.1",
35
- "astro": "^4.9.2",
36
- "astro-accelerator-utils": "^0.3.7",
37
- "cspell": "^8.8.4",
35
+ "astro": "^4.11.5",
36
+ "astro-accelerator-utils": "^0.3.8",
37
+ "cspell": "^8.10.0",
38
38
  "csv": "^6.3.9",
39
39
  "hast-util-from-selector": "^3.0.0",
40
40
  "html-to-text": "^9.0.5",
@@ -44,7 +44,7 @@
44
44
  "sharp": "^0.33.4"
45
45
  },
46
46
  "devDependencies": {
47
- "@playwright/test": "^1.44.1"
47
+ "@playwright/test": "^1.45.1"
48
48
  },
49
49
  "files": [
50
50
  ".npmrc",
@@ -66,6 +66,7 @@
66
66
  "src/pages/search.json.ts",
67
67
  "src/pages/sitemap.xml.ts",
68
68
  "src/pages/report/*",
69
+ "src/pages/report/oldest-content/*",
69
70
  "src/layouts/*",
70
71
  "src/themes/accelerator/components/*",
71
72
  "src/themes/accelerator/layouts/*",
@@ -0,0 +1,66 @@
1
+ /** @format */
2
+
3
+ :root {
4
+ --pop: #2d4295;
5
+
6
+ --color-header-bg: var(--pop);
7
+ --color-header-fg: #fff;
8
+ --color-row-border: #ddd;
9
+ --color-table-border: var(--pop);
10
+ --color-row-bg: #f9f9f9;
11
+ --color-row-bg-alt: #f3f3f3;
12
+ --color-row-bg-focus: #e5e5e5;
13
+
14
+ --block-radius: 0.3rem;
15
+ }
16
+
17
+ body {
18
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
19
+ padding: 2em;
20
+ }
21
+
22
+ table {
23
+ border-collapse: collapse;
24
+ margin: 25px 0;
25
+ font-size: 0.9em;
26
+ font-family: sans-serif;
27
+ min-width: 400px;
28
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
29
+ }
30
+
31
+ thead tr {
32
+ background-color: var(--color-header-bg);
33
+ color: var(--color-header-fg);
34
+ text-align: left;
35
+ border-radius: var(--block-radius) var(--block-radius) 0 0;
36
+ }
37
+
38
+ table th:first-child {
39
+ border-radius: var(--block-radius) 0 0 0;
40
+ }
41
+
42
+ table th:last-child {
43
+ border-radius: 0 var(--block-radius) 0 0;
44
+ }
45
+
46
+ th,
47
+ td {
48
+ padding: 12px 15px;
49
+ }
50
+
51
+ tbody tr {
52
+ background-color: var(--color-row-bg);
53
+ border-bottom: 1px solid var(--color-row-border);
54
+ }
55
+
56
+ tbody tr:nth-of-type(even) {
57
+ background-color: var(--color-row-bg-alt);
58
+ }
59
+
60
+ tbody tr:last-of-type {
61
+ border-bottom: 2px solid var(--color-table-border);
62
+ }
63
+
64
+ tbody tr:hover {
65
+ background-color: var(--color-row-bg-focus);
66
+ }
@@ -17,6 +17,7 @@ const pages = missingBanner.sort(PostOrdering.sortByPubDateDesc).slice(0, Math.m
17
17
  <head>
18
18
  <meta charset="utf-8" />
19
19
  <title>Missing banners</title>
20
+ <link rel="stylesheet" href="/css/report.css" />
20
21
  </head>
21
22
  <body>
22
23
  <h2>Report: Missing banners</h2>
@@ -17,6 +17,7 @@ const pages = missingMeta.sort(PostOrdering.sortByPubDateDesc).slice(0, Math.min
17
17
  <head>
18
18
  <meta charset="utf-8" />
19
19
  <title>Missing meta</title>
20
+ <link rel="stylesheet" href="/css/report.css" />
20
21
  </head>
21
22
  <body>
22
23
  <h2>Report: Missing meta</h2>
@@ -17,6 +17,7 @@ const pages = missingMeta.slice(0, Math.min(50, pageCount));
17
17
  <head>
18
18
  <meta charset="utf-8" />
19
19
  <title>Missing pubDate</title>
20
+ <link rel="stylesheet" href="/css/report.css" />
20
21
  </head>
21
22
  <body>
22
23
  <h2>Report: Missing pubDate</h2>
@@ -0,0 +1,97 @@
1
+ ---
2
+ import {
3
+ PostOrdering,
4
+ PostFiltering,
5
+ Accelerator,
6
+ } from 'astro-accelerator-utils';
7
+ import type { MarkdownInstance } from 'astro-accelerator-utils/types/Astro';
8
+ import type { Page } from 'astro';
9
+ import { SITE } from '@config';
10
+ import PagingLinks from '@components/PagingLinks.astro';
11
+
12
+ // Props
13
+ type Props = {
14
+ title: string;
15
+ page: Page<MarkdownInstance>;
16
+ headings: { depth: number; slug: string; text: string }[];
17
+ pubDate: Date;
18
+ };
19
+ const { page } = Astro.props satisfies Props;
20
+ const lang = SITE.default.lang;
21
+
22
+ // Logic
23
+ const accelerator = new Accelerator(SITE);
24
+ const stats = new accelerator.statistics(
25
+ 'report/oldest-content/[page].astro'
26
+ );
27
+ stats.start();
28
+
29
+ export async function getData() {
30
+ const accelerator = new Accelerator(SITE);
31
+ const allPages = accelerator.posts.all();
32
+ const pageCount = allPages.length;
33
+ const pages = allPages
34
+ .filter(PostFiltering.isListable)
35
+ .sort(PostOrdering.sortByModDate);
36
+
37
+ return pages;
38
+ }
39
+
40
+ export async function getStaticPaths({ paginate }: any) {
41
+ let data = await getData();
42
+
43
+ return paginate(data, {
44
+ pageSize: 50,
45
+ });
46
+ }
47
+
48
+ // Page Links
49
+ const pageLinks = accelerator.paging.links(
50
+ SITE.pageLinks,
51
+ page.lastPage,
52
+ page.currentPage,
53
+ page.url.current
54
+ );
55
+
56
+ stats.stop();
57
+ ---
58
+
59
+ <!doctype html>
60
+ <html>
61
+ <head>
62
+ <meta charset="utf-8" />
63
+ <title>Oldest content</title>
64
+ <link rel="stylesheet" href="/css/report.css" />
65
+ </head>
66
+ <body>
67
+ <h2>Report: Oldest content (Page <Fragment content={page.currentPage} />)</h2>
68
+ <table>
69
+ <thead>
70
+ <tr>
71
+ <th>Title</th>
72
+ <th>Published</th>
73
+ <th>Modified</th>
74
+ </tr>
75
+ </thead>
76
+ {
77
+ page.data.map((p) => (
78
+ <tr>
79
+ <td>
80
+ {PostFiltering.isListable(p) && (
81
+ <a href={accelerator.urlFormatter.formatAddress(p.url)}>
82
+ {p.frontmatter.title}
83
+ </a>
84
+ )}
85
+ {PostFiltering.isListable(p) == false && (
86
+ <span>{p.frontmatter.title}</span>
87
+ )}
88
+ </td>
89
+ <td>{p.frontmatter.pubDate}</td>
90
+ <td>{p.frontmatter.modDate}</td>
91
+ </tr>
92
+ ))
93
+ }
94
+ </table>
95
+ <PagingLinks lang={lang} page={page} pageLinks={pageLinks} />
96
+ </body>
97
+ </html>
@@ -0,0 +1,11 @@
1
+ ---
2
+ // warning: This file is overwritten by Astro Accelerator
3
+
4
+ import Redirect from 'src/layouts/Redirect.astro';
5
+
6
+ const frontmatter = {
7
+ redirect: './oldest-content/1/',
8
+ } as any;
9
+ ---
10
+
11
+ <Redirect frontmatter={frontmatter} headings={[]} />
@@ -20,6 +20,7 @@ const entries = accelerator.taxonomy.all();
20
20
  <head>
21
21
  <meta charset="utf-8" />
22
22
  <title>Taxonomy</title>
23
+ <link rel="stylesheet" href="/css/report.css" />
23
24
  </head>
24
25
  <body>
25
26
  <h2>Report: Taxonomy</h2>
@@ -1,46 +0,0 @@
1
- ---
2
- // warning: This file is overwritten by Astro Accelerator
3
-
4
- import { PostOrdering, PostFiltering, Accelerator } from 'astro-accelerator-utils';
5
- import { SITE } from '@config';
6
-
7
- // Logic
8
- const accelerator = new Accelerator(SITE);
9
-
10
- const allPages = accelerator.posts.all();
11
- const pageCount = allPages.length;
12
- const pages = allPages.filter(PostFiltering.isListable).sort(PostOrdering.sortByModDate).slice(0, Math.min(50, pageCount));
13
- ---
14
- <!doctype html>
15
- <html>
16
- <head>
17
- <meta charset="utf-8" />
18
- <title>Oldest content</title>
19
- </head>
20
- <body>
21
- <h2>Report: Oldest content</h2>
22
- <table>
23
- <thead>
24
- <tr>
25
- <th>Title</th>
26
- <th>Published</th>
27
- <th>Modified</th>
28
- </tr>
29
- </thead>
30
- {pages.map(p =>
31
- <tr>
32
- <td>
33
- {PostFiltering.isListable(p) && (
34
- <a href={ accelerator.urlFormatter.formatAddress(p.url) }>{ p.frontmatter.title }</a>
35
- )}
36
- {PostFiltering.isListable(p) == false && (
37
- <span>{ p.frontmatter.title }</span>
38
- )}
39
- </td>
40
- <td>{ p.frontmatter.pubDate }</td>
41
- <td>{ p.frontmatter.modDate }</td>
42
- </tr>
43
- )}
44
- </table>
45
- </body>
46
- </html>