astro-accelerator 0.0.18 → 0.0.20
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 +1 -1
- package/sample/src/pages/articles/2022/09/sample-post-1.md +4 -3
- package/sample/src/pages/articles.md +10 -0
- package/src/data/footer.ts +1 -1
- package/src/data/navigation.ts +1 -1
- package/src/pages/articles/[page].astro +4 -4
- package/src/pages/articles/feed.xml.ts +2 -2
- package/src/pages/authors/[author]/[page].astro +5 -6
- package/src/pages/category/[category]/[page].astro +4 -4
- package/src/pages/report/missing-banner.astro +3 -3
- package/src/pages/report/missing-meta.astro +3 -3
- package/src/pages/report/missing-pubdate.astro +42 -0
- package/src/pages/report/oldest-content.astro +3 -3
- package/src/pages/report/taxonomy.astro +2 -2
- package/src/pages/search.json.ts +2 -2
- package/src/pages/sitemap.xml.ts +2 -2
- package/src/pages/tag/[tag]/[page].astro +4 -4
- package/src/themes/accelerator/components/ArticleList.astro +2 -2
- package/src/themes/accelerator/components/Authors.astro +4 -4
- package/src/themes/accelerator/components/AuthorsMini.astro +3 -4
- package/src/themes/accelerator/components/Breadcrumbs.astro +3 -3
- package/src/themes/accelerator/components/Footer.astro +2 -2
- package/src/themes/accelerator/components/FooterItem.astro +2 -2
- package/src/themes/accelerator/components/Header.astro +4 -4
- package/src/themes/accelerator/components/HtmlHead.astro +1 -1
- package/src/themes/accelerator/components/Navigation.astro +2 -2
- package/src/themes/accelerator/components/NavigationBar.astro +2 -2
- package/src/themes/accelerator/components/NavigationItem.astro +3 -3
- package/src/themes/accelerator/components/Paging.astro +3 -3
- package/src/themes/accelerator/components/Related.astro +4 -4
- package/src/themes/accelerator/components/SkipLinks.astro +1 -1
- package/src/themes/accelerator/components/TableOfContents.astro +1 -1
- package/src/themes/accelerator/components/Taxonomy.astro +2 -2
- package/src/themes/accelerator/layouts/Author.astro +2 -2
- package/src/themes/accelerator/layouts/Default.astro +1 -1
- package/src/themes/accelerator/layouts/Search.astro +1 -1
- package/src/themes/accelerator/utilities/{Authors.astro → Authors.ts} +2 -4
- package/src/themes/accelerator/utilities/{Breadcrumbs.astro → Breadcrumbs.ts} +4 -6
- package/src/themes/accelerator/utilities/{Cache.astro → Cache.ts} +0 -2
- package/src/themes/accelerator/utilities/{DateFormat.astro → DateFormat.ts} +1 -3
- package/src/themes/accelerator/utilities/{Footer.astro → Footer.ts} +5 -7
- package/src/themes/accelerator/utilities/{Languages.astro → Languages.ts} +0 -2
- package/src/themes/accelerator/utilities/{Markdown.astro → Markdown.ts} +0 -2
- package/src/themes/accelerator/utilities/{NavPage.astro → NavPage.ts} +2 -4
- package/src/themes/accelerator/utilities/{Navigation.astro → Navigation.ts} +5 -7
- package/src/themes/accelerator/utilities/{NavigationTypes.astro → NavigationTypes.ts} +0 -2
- package/src/themes/accelerator/utilities/{PageLinks.astro → PageLinks.ts} +0 -2
- package/src/themes/accelerator/utilities/{PageQueries.astro → PageQueries.ts} +7 -8
- package/src/themes/accelerator/utilities/{PageTypeFilters.astro → PageTypeFilters.ts} +0 -2
- package/src/themes/accelerator/utilities/{Taxonomy.astro → Taxonomy.ts} +4 -6
- package/src/themes/accelerator/utilities/{Url.astro → Url.ts} +3 -3
package/package.json
CHANGED
|
@@ -6,20 +6,21 @@ pubDate: 2022-09-01
|
|
|
6
6
|
keywords: sample,post
|
|
7
7
|
description: A sample post
|
|
8
8
|
bannerImage:
|
|
9
|
-
src: /img/
|
|
9
|
+
src: /img/astro-lighthouse.png
|
|
10
10
|
alt: Dummy image
|
|
11
11
|
authors:
|
|
12
12
|
- steve-fenton
|
|
13
13
|
categories:
|
|
14
14
|
- Example
|
|
15
|
+
tags:
|
|
15
16
|
- Sample
|
|
16
17
|
---
|
|
17
18
|
|
|
18
19
|
This is an example post with more of the front matter set up, such as except and images.
|
|
19
20
|
|
|
20
21
|
:::figure
|
|
21
|
-
:img{src=/img/
|
|
22
|
-
::figcaption[
|
|
22
|
+
:img{src=/img/astro-lighthouse.png alt="Lighthouse score for Astro Accelerator"}
|
|
23
|
+
::figcaption[Lighthouse Score]
|
|
23
24
|
:::
|
|
24
25
|
|
|
25
26
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sit amet elit sodales, egestas odio eu, interdum nunc. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In elit odio, dapibus nec finibus sit amet, aliquam a tortor.
|
package/src/data/footer.ts
CHANGED
package/src/data/navigation.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
// For listing all articles in this folder
|
|
5
5
|
import t from '@util/language.json';
|
|
6
|
-
import { Lang } from '@util/Languages
|
|
6
|
+
import { Lang } from '@util/Languages';
|
|
7
7
|
|
|
8
8
|
import type { Page, MarkdownInstance } from 'astro';
|
|
9
9
|
|
|
10
10
|
import { Frontmatter, SITE } from '@config';
|
|
11
|
-
import { getPageLinks } from '@util/PageLinks
|
|
12
|
-
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters
|
|
13
|
-
import { getItem, setItem } from '@util/Cache
|
|
11
|
+
import { getPageLinks } from '@util/PageLinks';
|
|
12
|
+
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters';
|
|
13
|
+
import { getItem, setItem } from '@util/Cache';
|
|
14
14
|
|
|
15
15
|
import Default from 'src/layouts/Default.astro';
|
|
16
16
|
import ArticleList from '@components/ArticleList.astro';
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// Generates an ATOM feed of recent posts
|
|
4
4
|
import { SITE } from '@config';
|
|
5
|
-
import { addSlashToAddress } from '@util/Url
|
|
6
|
-
import { isListable } from '@util/PageTypeFilters
|
|
5
|
+
import { addSlashToAddress } from '@util/Url';
|
|
6
|
+
import { isListable } from '@util/PageTypeFilters';
|
|
7
7
|
|
|
8
8
|
async function getData() {
|
|
9
9
|
//@ts-ignore
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
|
|
4
4
|
// For listing all articles in this folder
|
|
5
5
|
import t from '@util/language.json';
|
|
6
|
-
import { Lang } from '@util/Languages
|
|
6
|
+
import { Lang } from '@util/Languages';
|
|
7
7
|
|
|
8
8
|
import type { Page, MarkdownInstance } from 'astro';
|
|
9
9
|
|
|
10
10
|
import { Frontmatter, SITE } from '@config';
|
|
11
|
-
import { getPageLinks } from '@util/PageLinks
|
|
12
|
-
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters
|
|
13
|
-
import { getItem, setItem } from '@util/Cache
|
|
11
|
+
import { getPageLinks } from '@util/PageLinks';
|
|
12
|
+
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters';
|
|
13
|
+
import { getItem, setItem } from '@util/Cache';
|
|
14
14
|
|
|
15
15
|
import Default from '@layouts/Default.astro';
|
|
16
16
|
import ArticleList from '@components/ArticleList.astro';
|
|
17
17
|
import Paging from '@components/Paging.astro';
|
|
18
|
-
import { getAuthorInfo } from '@util/PageQueries
|
|
18
|
+
import { getAuthorInfo } from '@util/PageQueries';
|
|
19
19
|
|
|
20
20
|
const lang = SITE.default.lang;
|
|
21
21
|
const currentUrl = new URL(Astro.request.url);
|
|
@@ -96,7 +96,6 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
96
96
|
const pageLinks = getPageLinks(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
97
97
|
---
|
|
98
98
|
<Default frontmatter={ frontmatter } headings={ headings }>
|
|
99
|
-
<Fragment set:html={ authorInfo.content }></Fragment>
|
|
100
99
|
<h2>Page {page.currentPage}</h2>
|
|
101
100
|
<ArticleList lang={ lang } posts={ page.data } />
|
|
102
101
|
<Paging lang={ lang } page={ page } pageLinks={ pageLinks } />
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
// For listing by frontmatter.categories
|
|
5
5
|
import t from '@util/language.json';
|
|
6
|
-
import { Lang } from '@util/Languages
|
|
6
|
+
import { Lang } from '@util/Languages';
|
|
7
7
|
|
|
8
8
|
import type { Page, MarkdownInstance } from 'astro';
|
|
9
9
|
|
|
10
10
|
import { Frontmatter, SITE } from '@config';
|
|
11
|
-
import { getPageLinks } from '@util/PageLinks
|
|
12
|
-
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters
|
|
13
|
-
import { getItem, setItem } from '@util/Cache
|
|
11
|
+
import { getPageLinks } from '@util/PageLinks';
|
|
12
|
+
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters';
|
|
13
|
+
import { getItem, setItem } from '@util/Cache';
|
|
14
14
|
|
|
15
15
|
import Default from 'src/layouts/Default.astro';
|
|
16
16
|
import ArticleList from '@components/ArticleList.astro';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import t from '@util/language.json';
|
|
3
|
-
import { Lang } from '@util/Languages
|
|
3
|
+
import { Lang } from '@util/Languages';
|
|
4
4
|
|
|
5
5
|
import type { Page, MarkdownInstance } from 'astro';
|
|
6
6
|
|
|
7
7
|
import type { Frontmatter } from '@config';
|
|
8
|
-
import { sortByPubDateDesc } from '@util/PageTypeFilters
|
|
9
|
-
import { getPages } from '@util/PageQueries
|
|
8
|
+
import { sortByPubDateDesc } from '@util/PageTypeFilters';
|
|
9
|
+
import { getPages } from '@util/PageQueries';
|
|
10
10
|
|
|
11
11
|
// Logic
|
|
12
12
|
const allPages = await getPages();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import t from '@util/language.json';
|
|
3
|
-
import { Lang } from '@util/Languages
|
|
3
|
+
import { Lang } from '@util/Languages';
|
|
4
4
|
|
|
5
5
|
import type { Page, MarkdownInstance } from 'astro';
|
|
6
6
|
|
|
7
7
|
import type { Frontmatter } from '@config';
|
|
8
|
-
import { sortByPubDateDesc } from '@util/PageTypeFilters
|
|
9
|
-
import { getPages } from '@util/PageQueries
|
|
8
|
+
import { sortByPubDateDesc } from '@util/PageTypeFilters';
|
|
9
|
+
import { getPages } from '@util/PageQueries';
|
|
10
10
|
|
|
11
11
|
// Logic
|
|
12
12
|
const allPages = await getPages();
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
import t from '@util/language.json';
|
|
3
|
+
import { Lang } from '@util/Languages';
|
|
4
|
+
|
|
5
|
+
import type { Page, MarkdownInstance } from 'astro';
|
|
6
|
+
|
|
7
|
+
import type { Frontmatter } from '@config';
|
|
8
|
+
import { sortByPubDateDesc } from '@util/PageTypeFilters';
|
|
9
|
+
import { getPages } from '@util/PageQueries';
|
|
10
|
+
|
|
11
|
+
// Logic
|
|
12
|
+
const allPages = await getPages();
|
|
13
|
+
const missingMeta = allPages.filter(p => (p.frontmatter.pubDate == null && p.frontmatter.layout != 'src/layouts/Redirect.astro'));
|
|
14
|
+
const pageCount = missingMeta.length;
|
|
15
|
+
const pages = missingMeta.slice(0, Math.min(50, pageCount));
|
|
16
|
+
---
|
|
17
|
+
<!doctype html>
|
|
18
|
+
<html>
|
|
19
|
+
<head>
|
|
20
|
+
<meta charset="utf-8" />
|
|
21
|
+
<title>Missing pubDate</title>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<h2>Report: Missing pubDate</h2>
|
|
25
|
+
<table>
|
|
26
|
+
<thead>
|
|
27
|
+
<tr>
|
|
28
|
+
<th>Title</th>
|
|
29
|
+
<th>Published</th>
|
|
30
|
+
<th>Modified</th>
|
|
31
|
+
</tr>
|
|
32
|
+
</thead>
|
|
33
|
+
{pages.map(p =>
|
|
34
|
+
<tr>
|
|
35
|
+
<td><a href={ p.url }>{ p.frontmatter.title }</a></td>
|
|
36
|
+
<td>{ p.frontmatter.pubDate }</td>
|
|
37
|
+
<td>{ p.frontmatter.modDate }</td>
|
|
38
|
+
</tr>
|
|
39
|
+
)}
|
|
40
|
+
</table>
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
import t from '@util/language.json';
|
|
3
|
-
import { Lang } from '@util/Languages
|
|
3
|
+
import { Lang } from '@util/Languages';
|
|
4
4
|
|
|
5
5
|
import type { Page, MarkdownInstance } from 'astro';
|
|
6
6
|
|
|
7
7
|
import type { Frontmatter } from '@config';
|
|
8
|
-
import { sortByModDate } from '@util/PageTypeFilters
|
|
9
|
-
import { getPages } from '@util/PageQueries
|
|
8
|
+
import { sortByModDate } from '@util/PageTypeFilters';
|
|
9
|
+
import { getPages } from '@util/PageQueries';
|
|
10
10
|
|
|
11
11
|
// Logic
|
|
12
12
|
const allPages = await getPages();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
import t from '@util/language.json';
|
|
3
|
-
import { Lang } from '@util/Languages
|
|
3
|
+
import { Lang } from '@util/Languages';
|
|
4
4
|
|
|
5
|
-
import { getTaxonomy, taxonomyLinks, sortByTitle } from '@util/Taxonomy
|
|
5
|
+
import { getTaxonomy, taxonomyLinks, sortByTitle } from '@util/Taxonomy';
|
|
6
6
|
|
|
7
7
|
// Lang
|
|
8
8
|
const _ = Lang('en');
|
package/src/pages/search.json.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import type { MarkdownInstance } from 'astro';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
|
-
import { showInSearch } from '@util/PageTypeFilters
|
|
6
|
-
import { addSlashToAddress } from '@util/Url
|
|
5
|
+
import { showInSearch } from '@util/PageTypeFilters';
|
|
6
|
+
import { addSlashToAddress } from '@util/Url';
|
|
7
7
|
|
|
8
8
|
const getData = async () => {
|
|
9
9
|
//@ts-ignore
|
package/src/pages/sitemap.xml.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// Generates an ATOM feed of recent posts
|
|
4
4
|
import { SITE } from '@config';
|
|
5
|
-
import { showInSitemap } from '@util/PageTypeFilters
|
|
6
|
-
import { addSlashToAddress } from '@util/Url
|
|
5
|
+
import { showInSitemap } from '@util/PageTypeFilters';
|
|
6
|
+
import { addSlashToAddress } from '@util/Url';
|
|
7
7
|
|
|
8
8
|
async function getData() {
|
|
9
9
|
//@ts-ignore
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
// For listing by frontmatter.tags
|
|
5
5
|
import t from '@util/language.json';
|
|
6
|
-
import { Lang } from '@util/Languages
|
|
6
|
+
import { Lang } from '@util/Languages';
|
|
7
7
|
|
|
8
8
|
import type { Page, MarkdownInstance } from 'astro';
|
|
9
9
|
|
|
10
10
|
import { Frontmatter, SITE } from '@config';
|
|
11
|
-
import { getPageLinks } from '@util/PageLinks
|
|
12
|
-
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters
|
|
13
|
-
import { getItem, setItem } from '@util/Cache
|
|
11
|
+
import { getPageLinks } from '@util/PageLinks';
|
|
12
|
+
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters';
|
|
13
|
+
import { getItem, setItem } from '@util/Cache';
|
|
14
14
|
|
|
15
15
|
import Default from 'src/layouts/Default.astro';
|
|
16
16
|
import ArticleList from '@components/ArticleList.astro';
|
|
@@ -3,8 +3,8 @@ import type { Frontmatter } from '@config';
|
|
|
3
3
|
import type { MarkdownInstance } from 'astro';
|
|
4
4
|
|
|
5
5
|
import t from '@util/language.json';
|
|
6
|
-
import { Lang } from '@util/Languages
|
|
7
|
-
import { addSlashToAddress } from '@util/Url
|
|
6
|
+
import { Lang } from '@util/Languages';
|
|
7
|
+
import { addSlashToAddress } from '@util/Url';
|
|
8
8
|
import { getImageInfo } from '@util/custom-markdown.mjs';
|
|
9
9
|
|
|
10
10
|
import AuthorsMini from '@components/AuthorsMini.astro';
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { SITE, Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
6
6
|
|
|
7
|
-
import { formatDate, formatModifiedDate } from '@util/DateFormat
|
|
8
|
-
import { getAuthorList } from '@util/Authors
|
|
9
|
-
import { addSlashToAddress } from '@util/Url
|
|
7
|
+
import { formatDate, formatModifiedDate } from '@util/DateFormat';
|
|
8
|
+
import { getAuthorList } from '@util/Authors';
|
|
9
|
+
import { addSlashToAddress } from '@util/Url';
|
|
10
10
|
import { getImageInfo } from '@util/custom-markdown.mjs';
|
|
11
11
|
|
|
12
12
|
// Properties
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
import { SITE, Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
6
|
-
import { getImageInfo } from '@util/custom-markdown.mjs';
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
7
6
|
|
|
8
|
-
import { formatDate } from '@util/DateFormat
|
|
9
|
-
import { getAuthorList } from '@util/Authors
|
|
7
|
+
import { formatDate } from '@util/DateFormat';
|
|
8
|
+
import { getAuthorList } from '@util/Authors';
|
|
10
9
|
|
|
11
10
|
// Properties
|
|
12
11
|
type Props = {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
6
|
-
import { getBreadcrumbs } from '@util/Breadcrumbs
|
|
7
|
-
import { addSlashToAddress } from '@util/Url
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
6
|
+
import { getBreadcrumbs } from '@util/Breadcrumbs';
|
|
7
|
+
import { addSlashToAddress } from '@util/Url';
|
|
8
8
|
|
|
9
9
|
// Properties
|
|
10
10
|
type Props = {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import type { Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
6
|
-
import { getMenu } from '@util/Footer
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
6
|
+
import { getMenu } from '@util/Footer';
|
|
7
7
|
|
|
8
8
|
import FooterItem from '@components/FooterItem.astro';
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
import t from '@util/language.json';
|
|
3
|
-
import { Lang } from '@util/Languages
|
|
3
|
+
import { Lang } from '@util/Languages';
|
|
4
4
|
|
|
5
|
-
import type { NavPage } from '@util/NavigationTypes
|
|
5
|
+
import type { NavPage } from '@util/NavigationTypes';
|
|
6
6
|
|
|
7
7
|
// Properties
|
|
8
8
|
type Props = {
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import type { Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
6
6
|
|
|
7
7
|
import { SITE } from '@config';
|
|
8
|
-
import { getPages } from '@util/PageQueries
|
|
9
|
-
import { addSlashToAddress } from '@util/Url
|
|
10
|
-
import { isSearch } from '@util/PageTypeFilters
|
|
8
|
+
import { getPages } from '@util/PageQueries';
|
|
9
|
+
import { addSlashToAddress } from '@util/Url';
|
|
10
|
+
import { isSearch } from '@util/PageTypeFilters';
|
|
11
11
|
|
|
12
12
|
// Properties
|
|
13
13
|
type Props = {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
6
6
|
|
|
7
|
-
import { getMenu } from '@util/Navigation
|
|
7
|
+
import { getMenu } from '@util/Navigation';
|
|
8
8
|
|
|
9
9
|
import NavigationItem from '@components/NavigationItem.astro';
|
|
10
10
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
6
6
|
|
|
7
|
-
import { getMenu } from '@util/Navigation
|
|
7
|
+
import { getMenu } from '@util/Navigation';
|
|
8
8
|
|
|
9
9
|
import NavigationItem from '@components/NavigationItem.astro';
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
import t from '@util/language.json';
|
|
3
|
-
import { Lang } from '@util/Languages
|
|
3
|
+
import { Lang } from '@util/Languages';
|
|
4
4
|
|
|
5
|
-
import type { NavPage } from '@util/NavigationTypes
|
|
6
|
-
import { addSlashToAddress } from '@util/Url
|
|
5
|
+
import type { NavPage } from '@util/NavigationTypes';
|
|
6
|
+
import { addSlashToAddress } from '@util/Url';
|
|
7
7
|
|
|
8
8
|
// Properties
|
|
9
9
|
type Props = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { MarkdownInstance, Page } from 'astro';
|
|
3
|
-
import type { Link } from '@util/PageLinks
|
|
3
|
+
import type { Link } from '@util/PageLinks';
|
|
4
4
|
|
|
5
5
|
import t from '@util/language.json';
|
|
6
|
-
import { Lang } from '@util/Languages
|
|
7
|
-
import { addSlashToAddress } from '@util/Url
|
|
6
|
+
import { Lang } from '@util/Languages';
|
|
7
|
+
import { addSlashToAddress } from '@util/Url';
|
|
8
8
|
|
|
9
9
|
// Properties
|
|
10
10
|
type Props = {
|
|
@@ -3,11 +3,11 @@ import type { Frontmatter } from '@config';
|
|
|
3
3
|
import type { MarkdownInstance } from 'astro';
|
|
4
4
|
|
|
5
5
|
import t from '@util/language.json';
|
|
6
|
-
import { Lang } from '@util/Languages
|
|
7
|
-
import { addSlashToAddress } from '@util/Url
|
|
6
|
+
import { Lang } from '@util/Languages';
|
|
7
|
+
import { addSlashToAddress } from '@util/Url';
|
|
8
8
|
import { getImageInfo } from '@util/custom-markdown.mjs'
|
|
9
|
-
import { getPages } from '@util/PageQueries
|
|
10
|
-
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters
|
|
9
|
+
import { getPages } from '@util/PageQueries';
|
|
10
|
+
import { isListable, sortByPubDateDesc } from '@util/PageTypeFilters';
|
|
11
11
|
|
|
12
12
|
import AuthorsMini from '@components/AuthorsMini.astro';
|
|
13
13
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import type { Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
6
6
|
|
|
7
|
-
import { taxonomyLinks } from '@util/Taxonomy
|
|
7
|
+
import { taxonomyLinks } from '@util/Taxonomy';
|
|
8
8
|
|
|
9
9
|
// Properties
|
|
10
10
|
type Props = {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { SITE, Frontmatter } from '@config';
|
|
3
3
|
|
|
4
4
|
import t from '@util/language.json';
|
|
5
|
-
import { Lang } from '@util/Languages
|
|
5
|
+
import { Lang } from '@util/Languages';
|
|
6
6
|
|
|
7
|
-
import { getPages } from '@util/PageQueries
|
|
7
|
+
import { getPages } from '@util/PageQueries';
|
|
8
8
|
|
|
9
9
|
import Default from './Default.astro';
|
|
10
10
|
import ArticleList from '@components/ArticleList.astro';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
---
|
|
2
1
|
import type { Frontmatter } from '@config';
|
|
3
2
|
import type { MarkdownInstance } from 'astro';
|
|
4
3
|
|
|
5
|
-
import { getPages } from "@util/PageQueries
|
|
6
|
-
import { isAuthor } from "@util/PageTypeFilters
|
|
4
|
+
import { getPages } from "@util/PageQueries";
|
|
5
|
+
import { isAuthor } from "@util/PageTypeFilters";
|
|
7
6
|
|
|
8
7
|
type BannerImage = { src: string; alt: string } | null;
|
|
9
8
|
type AuthorList = {
|
|
@@ -45,4 +44,3 @@ export async function getAuthorList (frontmatter: Frontmatter) {
|
|
|
45
44
|
|
|
46
45
|
return result;
|
|
47
46
|
}
|
|
48
|
-
---
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { mapNavPage, setCurrentPage, popMatchingPage } from '@util/NavPage.astro';
|
|
1
|
+
import { getPages } from '@util/PageQueries';
|
|
2
|
+
import { mapNavPage, setCurrentPage, popMatchingPage } from '@util/NavPage';
|
|
4
3
|
|
|
5
|
-
import type { NavPage } from '@util/NavigationTypes
|
|
4
|
+
import type { NavPage } from '@util/NavigationTypes';
|
|
6
5
|
|
|
7
6
|
export async function getBreadcrumbs (currentUrl: URL) {
|
|
8
7
|
const allPages = await getPages();
|
|
@@ -23,5 +22,4 @@ export async function getBreadcrumbs (currentUrl: URL) {
|
|
|
23
22
|
setCurrentPage(navPages, currentUrl);
|
|
24
23
|
|
|
25
24
|
return navPages;
|
|
26
|
-
}
|
|
27
|
-
---
|
|
25
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
---
|
|
2
1
|
import fs from 'fs';
|
|
3
2
|
import path from 'path';
|
|
4
3
|
import process from 'process';
|
|
@@ -39,4 +38,3 @@ export async function setItem (key: string, value: object) {
|
|
|
39
38
|
const itemPath = await getItemPath(key);
|
|
40
39
|
await fs.promises.writeFile(itemPath, JSON.stringify(value));
|
|
41
40
|
}
|
|
42
|
-
---
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
---
|
|
2
1
|
// Data file `navigation.ts`
|
|
3
2
|
import { menu } from 'src/data/footer';
|
|
4
3
|
|
|
5
4
|
import { SITE } from '@config';
|
|
6
|
-
import { getItem, setItem } from '@util/Cache
|
|
7
|
-
import { setCurrentPage } from '@util/NavPage
|
|
8
|
-
import { NavPage, isNavPage } from '@util/NavigationTypes
|
|
9
|
-
import { getTaxonomy, taxonomyLinks } from '@util/Taxonomy
|
|
10
|
-
import { Lang } from '@util/Languages
|
|
5
|
+
import { getItem, setItem } from '@util/Cache';
|
|
6
|
+
import { setCurrentPage } from '@util/NavPage';
|
|
7
|
+
import { NavPage, isNavPage } from '@util/NavigationTypes';
|
|
8
|
+
import { getTaxonomy, taxonomyLinks } from '@util/Taxonomy';
|
|
9
|
+
import { Lang } from '@util/Languages';
|
|
11
10
|
import t from '@util/language.json';
|
|
12
11
|
|
|
13
12
|
export async function getMenu (currentUrl: URL, lang: string) {
|
|
@@ -173,4 +172,3 @@ if (pageHierarchy == null) {
|
|
|
173
172
|
|
|
174
173
|
return pageHierarchy;
|
|
175
174
|
}
|
|
176
|
-
---
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
---
|
|
2
1
|
export function Lang (lang: string): (entry: Entry) => string {
|
|
3
2
|
const altLang = lang.indexOf('-') > -1
|
|
4
3
|
? lang.split('-')[0]
|
|
@@ -11,4 +10,3 @@ export function Lang (lang: string): (entry: Entry) => string {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
export type Entry = { [key: string]: string };
|
|
14
|
-
---
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
---
|
|
2
1
|
import type { MarkdownInstance } from 'astro';
|
|
3
|
-
import type { NavPage } from './NavigationTypes
|
|
2
|
+
import type { NavPage } from './NavigationTypes';
|
|
4
3
|
|
|
5
|
-
import { addSlashToAddress } from './Url
|
|
4
|
+
import { addSlashToAddress } from './Url';
|
|
6
5
|
|
|
7
6
|
export function mapNavPage (page: MarkdownInstance<Record<string, any>>) {
|
|
8
7
|
|
|
@@ -62,4 +61,3 @@ export function popMatchingPage (allPages: MarkdownInstance<Record<string, any>>
|
|
|
62
61
|
|
|
63
62
|
return match;
|
|
64
63
|
};
|
|
65
|
-
---
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
---
|
|
2
1
|
// Data file `navigation.ts`
|
|
3
2
|
import { menu } from 'src/data/navigation';
|
|
4
3
|
|
|
5
|
-
import { getItem, setItem } from '@util/Cache
|
|
6
|
-
import { showInMenu } from '@util/PageTypeFilters
|
|
7
|
-
import { mapNavPage, setCurrentPage } from '@util/NavPage
|
|
8
|
-
import { NavPage, isNavPage } from '@util/NavigationTypes
|
|
9
|
-
import { getTopLevelPages, getPages } from '@util/PageQueries
|
|
4
|
+
import { getItem, setItem } from '@util/Cache';
|
|
5
|
+
import { showInMenu } from '@util/PageTypeFilters';
|
|
6
|
+
import { mapNavPage, setCurrentPage } from '@util/NavPage';
|
|
7
|
+
import { NavPage, isNavPage } from '@util/NavigationTypes';
|
|
8
|
+
import { getTopLevelPages, getPages } from '@util/PageQueries';
|
|
10
9
|
|
|
11
10
|
export async function getMenu (currentUrl: URL) {
|
|
12
11
|
const key = 'Navigation__getMenu';
|
|
@@ -78,4 +77,3 @@ export async function getNavigation (currentUrl: URL) {
|
|
|
78
77
|
|
|
79
78
|
return pageHierarchy;
|
|
80
79
|
}
|
|
81
|
-
---
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
---
|
|
2
1
|
import type { MarkdownInstance } from "astro";
|
|
3
2
|
import { SITE } from '@config';
|
|
4
|
-
import { getItem, setItem } from '@util/Cache
|
|
5
|
-
import { isAuthor } from '@util/PageTypeFilters
|
|
3
|
+
import { getItem, setItem } from '@util/Cache';
|
|
4
|
+
import { isAuthor } from '@util/PageTypeFilters';
|
|
6
5
|
|
|
7
6
|
export type PagePredicate = (value: MarkdownInstance<Record<string, any>>, index: number, array: MarkdownInstance<Record<string, any>>[]) => boolean;
|
|
8
7
|
|
|
@@ -11,7 +10,8 @@ export async function getPages (filter?: PagePredicate | null): Promise<Markdown
|
|
|
11
10
|
let allPages: MarkdownInstance<Record<string,any>>[] = await getItem(key);
|
|
12
11
|
|
|
13
12
|
if (allPages == null) {
|
|
14
|
-
|
|
13
|
+
const pageImportResult = import.meta.glob("../../../pages/**/*.md", { eager: true });
|
|
14
|
+
allPages = Object.values(pageImportResult) as MarkdownInstance<Record<string,any>>[];
|
|
15
15
|
await setItem(key, allPages);
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -53,14 +53,14 @@ export async function getAuthorInfo (slug: string) {
|
|
|
53
53
|
let authorInfo = await getItem(cacheKey);
|
|
54
54
|
|
|
55
55
|
if (authorInfo == null) {
|
|
56
|
-
const allPages = await
|
|
56
|
+
const allPages = await getPages();
|
|
57
|
+
|
|
57
58
|
const author = allPages
|
|
58
59
|
.filter(isAuthor)
|
|
59
60
|
.filter(x => x.url?.split('/')[2] == slug)[0];
|
|
60
61
|
|
|
61
62
|
authorInfo = {
|
|
62
|
-
frontmatter: author.frontmatter
|
|
63
|
-
content: author.compiledContent()
|
|
63
|
+
frontmatter: author.frontmatter
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
await setItem(cacheKey, authorInfo);
|
|
@@ -68,4 +68,3 @@ export async function getAuthorInfo (slug: string) {
|
|
|
68
68
|
|
|
69
69
|
return authorInfo;
|
|
70
70
|
}
|
|
71
|
-
---
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
---
|
|
2
1
|
import type { MarkdownInstance } from 'astro';
|
|
3
2
|
|
|
4
3
|
export function showInSitemap (p: MarkdownInstance<Record<string, any>>) {
|
|
@@ -66,4 +65,3 @@ export function sortByModDate (a: MarkdownInstance<Record<string, any>>, b: Mark
|
|
|
66
65
|
const dateB = b.frontmatter.modDate || b.frontmatter.pubDate || '1970-01-01';
|
|
67
66
|
return dateA.localeCompare(dateB);
|
|
68
67
|
}
|
|
69
|
-
---
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Entry } from '@util/Languages.astro';
|
|
1
|
+
import type { Entry } from '@util/Languages';
|
|
3
2
|
|
|
4
3
|
import t from '@util/language.json';
|
|
5
4
|
|
|
6
5
|
import { SITE } from '@config';
|
|
7
|
-
import { getPages } from '@util/PageQueries
|
|
8
|
-
import { getItem, setItem } from '@util/Cache
|
|
9
|
-
import { addSlashToAddress } from '@util/Url
|
|
6
|
+
import { getPages } from '@util/PageQueries';
|
|
7
|
+
import { getItem, setItem } from '@util/Cache';
|
|
8
|
+
import { addSlashToAddress } from '@util/Url';
|
|
10
9
|
|
|
11
10
|
type TaxonomyEntry = {
|
|
12
11
|
title: string;
|
|
@@ -109,4 +108,3 @@ export async function getTaxonomy (): Promise<Taxonomy> {
|
|
|
109
108
|
|
|
110
109
|
return taxonomy;
|
|
111
110
|
}
|
|
112
|
-
---
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { SITE } from '@config';
|
|
2
|
+
|
|
2
3
|
export function addSlashToUrl (url: URL) {
|
|
3
4
|
url.pathname += url.pathname.endsWith('/') ? '' : '/';
|
|
4
5
|
return url;
|
|
@@ -13,7 +14,6 @@ export function addSlashToAddress (address: string | undefined) {
|
|
|
13
14
|
return address;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const url = addSlashToUrl(new URL(address,
|
|
17
|
+
const url = addSlashToUrl(new URL(address, SITE.url));
|
|
17
18
|
return url.pathname + url.search;
|
|
18
19
|
}
|
|
19
|
-
---
|