astro-accelerator 0.0.39 → 0.0.41
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/README.md +4 -1
- package/package.json +2 -2
- package/src/pages/articles/[page].astro +3 -3
- package/src/pages/articles/feed.xml.ts +5 -5
- package/src/pages/authors/[author]/[page].astro +15 -13
- package/src/pages/category/[category]/[page].astro +3 -3
- package/src/pages/report/missing-banner.astro +4 -6
- package/src/pages/report/missing-meta.astro +4 -6
- package/src/pages/report/missing-pubdate.astro +4 -6
- package/src/pages/report/oldest-content.astro +4 -6
- package/src/pages/report/taxonomy.astro +6 -5
- package/src/pages/search.json.ts +4 -5
- package/src/pages/sitemap.xml.ts +3 -3
- package/src/pages/tag/[tag]/[page].astro +3 -3
- package/src/themes/accelerator/components/ArticleList.astro +5 -6
- package/src/themes/accelerator/components/Authors.astro +7 -11
- package/src/themes/accelerator/components/AuthorsMini.astro +4 -7
- package/src/themes/accelerator/components/Breadcrumbs.astro +4 -7
- package/src/themes/accelerator/components/Footer.astro +4 -2
- package/src/themes/accelerator/components/Header.astro +4 -6
- package/src/themes/accelerator/components/HtmlHead.astro +4 -5
- package/src/themes/accelerator/components/Navigation.astro +3 -6
- package/src/themes/accelerator/components/NavigationBar.astro +3 -6
- package/src/themes/accelerator/components/NavigationItem.astro +3 -3
- package/src/themes/accelerator/components/PagingLinks.astro +6 -6
- package/src/themes/accelerator/components/Related.astro +5 -7
- package/src/themes/accelerator/components/Taxonomy.astro +4 -2
- package/src/themes/accelerator/layouts/Author.astro +3 -3
- package/src/themes/accelerator/layouts/Default.astro +4 -4
- package/src/pages/tag/[tag]/index.astro +0 -20
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# Astro Accelerator
|
|
2
2
|
|
|
3
|
-
Review the documentation at [astro.stevefenton.co.uk](https://astro.stevefenton.co.uk/)
|
|
4
3
|
|
|
5
4
|
[](https://github.com/Steve-Fenton/astro-accelerator/actions/workflows/build-astro.yml)
|
|
6
5
|
|
|
6
|
+
Review the documentation at [astro.stevefenton.co.uk](https://astro.stevefenton.co.uk/)
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/astro-accelerator/)
|
|
9
|
+
[](https://www.npmjs.com/package/astro-accelerator/)
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.41",
|
|
3
3
|
"author": "Steve Fenton",
|
|
4
4
|
"name": "astro-accelerator",
|
|
5
5
|
"description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@squoosh/lib": "^0.4.0",
|
|
28
28
|
"astro": "^1.6.6",
|
|
29
|
-
"astro-accelerator-utils": "^0.
|
|
29
|
+
"astro-accelerator-utils": "^0.2.8",
|
|
30
30
|
"hast-util-from-selector": "^2.0.0",
|
|
31
31
|
"remark-directive": "^2.0.1"
|
|
32
32
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// warning: This file is overwritten by Astro Accelerator
|
|
3
3
|
|
|
4
4
|
// For listing all articles in this folder
|
|
5
|
-
import { PostFiltering, PostOrdering,
|
|
5
|
+
import { PostFiltering, PostOrdering, Accelerator } from 'astro-accelerator-utils';
|
|
6
6
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
7
7
|
import type { MarkdownInstance } from 'astro-accelerator-utils/types/Astro';
|
|
8
8
|
import type { Page } from 'astro';
|
|
@@ -35,7 +35,7 @@ const frontmatter: Frontmatter = {
|
|
|
35
35
|
const _ = Lang(lang);
|
|
36
36
|
|
|
37
37
|
// Logic
|
|
38
|
-
const
|
|
38
|
+
const accelerator = new Accelerator(SITE);
|
|
39
39
|
|
|
40
40
|
export async function getData() {
|
|
41
41
|
const sourcePosts = await Astro.glob('./**/*.md') as MarkdownInstance[];
|
|
@@ -55,7 +55,7 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// Page Links
|
|
58
|
-
const pageLinks = paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
58
|
+
const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
59
59
|
---
|
|
60
60
|
<Default frontmatter={ frontmatter } headings={ headings }>
|
|
61
61
|
<h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString())}</h2>
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
// Generates an ATOM feed of recent posts
|
|
4
4
|
import { SITE } from '@config';
|
|
5
|
-
import {
|
|
5
|
+
import { Accelerator, PostFiltering } from 'astro-accelerator-utils';
|
|
6
6
|
|
|
7
7
|
async function getData() {
|
|
8
8
|
//@ts-ignore
|
|
9
9
|
const allArticles = import.meta.glob('./**/*.md');
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
|
|
11
|
+
const accelerator = new Accelerator(SITE);
|
|
12
12
|
|
|
13
13
|
let articles = [];
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ async function getData() {
|
|
|
16
16
|
const article: any = await allArticles[path]();
|
|
17
17
|
|
|
18
18
|
if (PostFiltering.isListable(article)) {
|
|
19
|
-
article.frontmatter.title = await markdown.getTextFrom(article.frontmatter.title ?? '');
|
|
19
|
+
article.frontmatter.title = await accelerator.markdown.getTextFrom(article.frontmatter.title ?? '');
|
|
20
20
|
|
|
21
21
|
articles.push({
|
|
22
22
|
url: article.url,
|
|
@@ -34,7 +34,7 @@ async function getData() {
|
|
|
34
34
|
<entry>
|
|
35
35
|
<title>${a.frontmatter.title ?? ''}</title>
|
|
36
36
|
<link href="${ SITE.url + a.url }" />
|
|
37
|
-
<id>${ SITE.url + urlFormatter.addSlashToAddress(a.url) }</id>
|
|
37
|
+
<id>${ SITE.url + accelerator.urlFormatter.addSlashToAddress(a.url) }</id>
|
|
38
38
|
<published>${ a.frontmatter.pubDate }</published>
|
|
39
39
|
<updated>${ a.frontmatter.pubDate ?? a.frontmatter.pubDate }</updated>
|
|
40
40
|
<summary>${ a.frontmatter.description ?? '' }</summary>
|
|
@@ -2,28 +2,32 @@
|
|
|
2
2
|
// warning: This file is overwritten by Astro Accelerator
|
|
3
3
|
|
|
4
4
|
// For listing all articles in this folder
|
|
5
|
-
import { PostFiltering, PostOrdering,
|
|
5
|
+
import { PostFiltering, PostOrdering, Accelerator } from 'astro-accelerator-utils';
|
|
6
6
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
7
7
|
import type { MarkdownInstance } from 'astro-accelerator-utils/types/Astro';
|
|
8
8
|
import type { Page } from 'astro';
|
|
9
9
|
import { Translations, Lang } from '@util/Languages';
|
|
10
10
|
import { SITE } from '@config';
|
|
11
|
-
import Default from '
|
|
11
|
+
import Default from 'src/layouts/Default.astro';
|
|
12
12
|
import ArticleList from '@components/ArticleList.astro';
|
|
13
13
|
import PagingLinks from '@components/PagingLinks.astro';
|
|
14
14
|
|
|
15
|
+
const accelerator = new Accelerator(SITE);
|
|
16
|
+
|
|
15
17
|
const lang = SITE.default.lang;
|
|
16
18
|
const currentUrl = new URL(Astro.request.url);
|
|
17
|
-
const slug =
|
|
18
|
-
|
|
19
|
-
const markdown = new Markdown();
|
|
20
|
-
const cache = new Cache(SITE.cacheMaxAge);
|
|
21
|
-
const posts = new Posts(cache);
|
|
19
|
+
const slug = accelerator.urlFormatter.getAuthorId(currentUrl);
|
|
22
20
|
|
|
23
|
-
const author = posts.all()
|
|
21
|
+
const author = accelerator.posts.all()
|
|
24
22
|
.filter(PostFiltering.isAuthor)
|
|
25
|
-
.filter(x =>
|
|
23
|
+
.filter(x => {
|
|
24
|
+
if (!x.url) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
26
27
|
|
|
28
|
+
const url = new URL(x.url, SITE.url);
|
|
29
|
+
return accelerator.urlFormatter.getAuthorId(url) == slug;
|
|
30
|
+
})[0];
|
|
27
31
|
|
|
28
32
|
// Props
|
|
29
33
|
type Props = {
|
|
@@ -39,14 +43,12 @@ const authorFrontmatter = {
|
|
|
39
43
|
} as Frontmatter;
|
|
40
44
|
|
|
41
45
|
const text = (author.frontmatter.summary ?? '').replace('\n', '\n\n');
|
|
42
|
-
const authorText = markdown.getHtmlFrom(text);
|
|
46
|
+
const authorText = accelerator.markdown.getHtmlFrom(text);
|
|
43
47
|
|
|
44
48
|
// Language
|
|
45
49
|
const _ = Lang(lang);
|
|
46
50
|
|
|
47
51
|
// Logic
|
|
48
|
-
const paging = new Paging();
|
|
49
|
-
|
|
50
52
|
type AuthorData = {
|
|
51
53
|
posts: MarkdownInstance[];
|
|
52
54
|
authors: string[];
|
|
@@ -92,7 +94,7 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
// Page Links
|
|
95
|
-
const pageLinks = paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
97
|
+
const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
96
98
|
---
|
|
97
99
|
<Default frontmatter={ authorFrontmatter } headings={ headings }>
|
|
98
100
|
<Fragment set:html={ authorText } />
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// warning: This file is overwritten by Astro Accelerator
|
|
3
3
|
|
|
4
4
|
// For listing by frontmatter.categories
|
|
5
|
-
import { PostFiltering, PostOrdering,
|
|
5
|
+
import { PostFiltering, PostOrdering, Accelerator } from 'astro-accelerator-utils';
|
|
6
6
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
7
7
|
import type { MarkdownInstance } from 'astro-accelerator-utils/types/Astro';
|
|
8
8
|
import type { Page } from 'astro';
|
|
@@ -38,7 +38,7 @@ const frontmatter: Frontmatter = {
|
|
|
38
38
|
const _ = Lang(lang);
|
|
39
39
|
|
|
40
40
|
// Logic
|
|
41
|
-
const
|
|
41
|
+
const accelerator = new Accelerator(SITE);
|
|
42
42
|
|
|
43
43
|
type CategoryData = {
|
|
44
44
|
posts: MarkdownInstance[];
|
|
@@ -87,7 +87,7 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// Page Links
|
|
90
|
-
const pageLinks = paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
90
|
+
const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
91
91
|
---
|
|
92
92
|
<Default frontmatter={ frontmatter } headings={ headings }>
|
|
93
93
|
<h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString())}</h2>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { PostOrdering,
|
|
2
|
+
import { PostOrdering, Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import { SITE } from '@config';
|
|
4
4
|
|
|
5
5
|
// Logic
|
|
6
|
-
const
|
|
7
|
-
const posts = new Posts(cache);
|
|
8
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
6
|
+
const accelerator = new Accelerator(SITE);
|
|
9
7
|
|
|
10
|
-
const allPages = posts.all();
|
|
8
|
+
const allPages = accelerator.posts.all();
|
|
11
9
|
const missingBanner = allPages.filter(p => p.frontmatter.bannerImage == null && p.frontmatter.layout != 'src/layouts/Redirect.astro');
|
|
12
10
|
const pageCount = missingBanner.length;
|
|
13
11
|
const pages = missingBanner.sort(PostOrdering.sortByPubDateDesc).slice(0, Math.min(50, pageCount));
|
|
@@ -30,7 +28,7 @@ const pages = missingBanner.sort(PostOrdering.sortByPubDateDesc).slice(0, Math.m
|
|
|
30
28
|
</thead>
|
|
31
29
|
{pages.map(p =>
|
|
32
30
|
<tr>
|
|
33
|
-
<td><a href={ urlFormatter.addSlashToAddress(p.url) }>{ p.frontmatter.title }</a></td>
|
|
31
|
+
<td><a href={ accelerator.urlFormatter.addSlashToAddress(p.url) }>{ p.frontmatter.title }</a></td>
|
|
34
32
|
<td>{ p.frontmatter.pubDate }</td>
|
|
35
33
|
<td>{ p.frontmatter.modDate }</td>
|
|
36
34
|
</tr>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { PostOrdering,
|
|
2
|
+
import { PostOrdering, Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import { SITE } from '@config';
|
|
4
4
|
|
|
5
5
|
// Logic
|
|
6
|
-
const
|
|
7
|
-
const posts = new Posts(cache);
|
|
8
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
6
|
+
const accelerator = new Accelerator(SITE);
|
|
9
7
|
|
|
10
|
-
const allPages = posts.all();
|
|
8
|
+
const allPages = accelerator.posts.all();
|
|
11
9
|
const missingMeta = allPages.filter(p => (p.frontmatter.keywords == null || p.frontmatter.description == null) && p.frontmatter.layout != 'src/layouts/Redirect.astro');
|
|
12
10
|
const pageCount = missingMeta.length;
|
|
13
11
|
const pages = missingMeta.sort(PostOrdering.sortByPubDateDesc).slice(0, Math.min(50, pageCount));
|
|
@@ -30,7 +28,7 @@ const pages = missingMeta.sort(PostOrdering.sortByPubDateDesc).slice(0, Math.min
|
|
|
30
28
|
</thead>
|
|
31
29
|
{pages.map(p =>
|
|
32
30
|
<tr>
|
|
33
|
-
<td><a href={ urlFormatter.addSlashToAddress(p.url) }>{ p.frontmatter.title }</a></td>
|
|
31
|
+
<td><a href={ accelerator.urlFormatter.addSlashToAddress(p.url) }>{ p.frontmatter.title }</a></td>
|
|
34
32
|
<td>{ p.frontmatter.pubDate }</td>
|
|
35
33
|
<td>{ p.frontmatter.modDate }</td>
|
|
36
34
|
</tr>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import { SITE } from '@config';
|
|
4
4
|
|
|
5
5
|
// Logic
|
|
6
|
-
const
|
|
7
|
-
const posts = new Posts(cache);
|
|
8
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
6
|
+
const accelerator = new Accelerator(SITE);
|
|
9
7
|
|
|
10
|
-
const allPages = posts.all();
|
|
8
|
+
const allPages = accelerator.posts.all();
|
|
11
9
|
const missingMeta = allPages.filter(p => (p.frontmatter.pubDate == null && p.frontmatter.layout != 'src/layouts/Redirect.astro'));
|
|
12
10
|
const pageCount = missingMeta.length;
|
|
13
11
|
const pages = missingMeta.slice(0, Math.min(50, pageCount));
|
|
@@ -30,7 +28,7 @@ const pages = missingMeta.slice(0, Math.min(50, pageCount));
|
|
|
30
28
|
</thead>
|
|
31
29
|
{pages.map(p =>
|
|
32
30
|
<tr>
|
|
33
|
-
<td><a href={ urlFormatter.addSlashToAddress(p.url) }>{ p.frontmatter.title }</a></td>
|
|
31
|
+
<td><a href={ accelerator.urlFormatter.addSlashToAddress(p.url) }>{ p.frontmatter.title }</a></td>
|
|
34
32
|
<td>{ p.frontmatter.pubDate }</td>
|
|
35
33
|
<td>{ p.frontmatter.modDate }</td>
|
|
36
34
|
</tr>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { PostOrdering, PostFiltering,
|
|
2
|
+
import { PostOrdering, PostFiltering, Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import { SITE } from '@config';
|
|
4
4
|
|
|
5
5
|
// Logic
|
|
6
|
-
const
|
|
7
|
-
const posts = new Posts(cache);
|
|
8
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
6
|
+
const accelerator = new Accelerator(SITE);
|
|
9
7
|
|
|
10
|
-
const allPages = posts.all();
|
|
8
|
+
const allPages = accelerator.posts.all();
|
|
11
9
|
const pageCount = allPages.length;
|
|
12
10
|
const pages = allPages.sort(PostOrdering.sortByModDate).slice(0, Math.min(50, pageCount));
|
|
13
11
|
---
|
|
@@ -31,7 +29,7 @@ const pages = allPages.sort(PostOrdering.sortByModDate).slice(0, Math.min(50, pa
|
|
|
31
29
|
<tr>
|
|
32
30
|
<td>
|
|
33
31
|
{PostFiltering.isListable(p) && (
|
|
34
|
-
<a href={ urlFormatter.addSlashToAddress(p.url) }>{ p.frontmatter.title }</a>
|
|
32
|
+
<a href={ accelerator.urlFormatter.addSlashToAddress(p.url) }>{ p.frontmatter.title }</a>
|
|
35
33
|
)}
|
|
36
34
|
{PostFiltering.isListable(p) == false && (
|
|
37
35
|
<span>{ p.frontmatter.title }</span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import { Lang } from '@util/Languages';
|
|
4
4
|
import { Translations } from '@util/Languages';
|
|
5
5
|
import { SITE } from '@config';
|
|
@@ -8,9 +8,10 @@ import { SITE } from '@config';
|
|
|
8
8
|
const _ = Lang('en');
|
|
9
9
|
|
|
10
10
|
// Logic
|
|
11
|
+
const accelerator = new Accelerator(SITE);
|
|
11
12
|
|
|
12
|
-
const links =
|
|
13
|
-
const
|
|
13
|
+
const links = accelerator.taxonomy.links(Translations, _, SITE.subfolder);
|
|
14
|
+
const entries = accelerator.taxonomy.all();
|
|
14
15
|
---
|
|
15
16
|
<!doctype html>
|
|
16
17
|
<html>
|
|
@@ -28,14 +29,14 @@ const taxonomy = await Taxonomy.getTaxonomy();
|
|
|
28
29
|
<th>Count</th>
|
|
29
30
|
</tr>
|
|
30
31
|
</thead>
|
|
31
|
-
{
|
|
32
|
+
{entries.categories.map(t =>
|
|
32
33
|
<tr>
|
|
33
34
|
<td>{ links.category }</td>
|
|
34
35
|
<td><a href={ links.getCategoryLink(t.title) }>{ t.title }</a></td>
|
|
35
36
|
<td>{ t.count }</td>
|
|
36
37
|
</tr>
|
|
37
38
|
)}
|
|
38
|
-
{
|
|
39
|
+
{entries.tags.map(t =>
|
|
39
40
|
<tr>
|
|
40
41
|
<td>{ links.tag }</td>
|
|
41
42
|
<td><a href={ links.getTagLink(t.title) }>{ t.title }</a></td>
|
package/src/pages/search.json.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// warning: This file is overwritten by Astro Accelerator
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Accelerator, PostFiltering } from 'astro-accelerator-utils';
|
|
4
4
|
import type { MarkdownInstance } from 'astro';
|
|
5
5
|
import { SITE } from '@config';
|
|
6
6
|
|
|
@@ -9,8 +9,7 @@ const getData = async () => {
|
|
|
9
9
|
const allPages = import.meta.glob('./**/*.md');
|
|
10
10
|
const items = [];
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
const markdown = new Markdown();
|
|
12
|
+
const accelerator = new Accelerator(SITE);
|
|
14
13
|
|
|
15
14
|
for (const path in allPages) {
|
|
16
15
|
const page = await allPages[path]() as MarkdownInstance<Record<string, any>>;
|
|
@@ -26,7 +25,7 @@ const getData = async () => {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
const headings = await page.getHeadings();
|
|
29
|
-
const title = await markdown.getTextFrom(page.frontmatter.title ?? '');
|
|
28
|
+
const title = await accelerator.markdown.getTextFrom(page.frontmatter.title ?? '');
|
|
30
29
|
|
|
31
30
|
items.push({
|
|
32
31
|
title: title,
|
|
@@ -35,7 +34,7 @@ const getData = async () => {
|
|
|
35
34
|
}),
|
|
36
35
|
description: page.frontmatter.description ?? '',
|
|
37
36
|
tags: page.frontmatter.tags ?? [],
|
|
38
|
-
url: SITE.url + urlFormatter.addSlashToAddress(url),
|
|
37
|
+
url: SITE.url + accelerator.urlFormatter.addSlashToAddress(url),
|
|
39
38
|
date: page.frontmatter.pubDate ?? ''
|
|
40
39
|
});
|
|
41
40
|
}
|
package/src/pages/sitemap.xml.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
// Generates an ATOM feed of recent posts
|
|
4
4
|
import { SITE } from '@config';
|
|
5
|
-
import { PostFiltering,
|
|
5
|
+
import { PostFiltering, Accelerator } from 'astro-accelerator-utils';
|
|
6
6
|
|
|
7
7
|
async function getData() {
|
|
8
8
|
//@ts-ignore
|
|
9
9
|
const allPages = import.meta.glob('./**/*.md');
|
|
10
10
|
|
|
11
|
+
const accelerator = new Accelerator(SITE);
|
|
11
12
|
let pages = [];
|
|
12
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
13
13
|
|
|
14
14
|
for (const path in allPages) {
|
|
15
15
|
const article: any = await allPages[path]();
|
|
@@ -18,7 +18,7 @@ async function getData() {
|
|
|
18
18
|
if (addToSitemap) {
|
|
19
19
|
pages.push(`
|
|
20
20
|
<url>
|
|
21
|
-
<loc>${ SITE.url + urlFormatter.addSlashToAddress(article.url) }</loc>
|
|
21
|
+
<loc>${ SITE.url + accelerator.urlFormatter.addSlashToAddress(article.url) }</loc>
|
|
22
22
|
<lastmod>${ article.frontmatter.pubDate }</lastmod>
|
|
23
23
|
</url>`);
|
|
24
24
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// warning: This file is overwritten by Astro Accelerator
|
|
3
3
|
|
|
4
4
|
// For listing by frontmatter.tags
|
|
5
|
-
import { PostFiltering, PostOrdering,
|
|
5
|
+
import { PostFiltering, PostOrdering, Accelerator } from 'astro-accelerator-utils';
|
|
6
6
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
7
7
|
import type { MarkdownInstance } from 'astro-accelerator-utils/types/Astro';
|
|
8
8
|
import type { Page } from 'astro';
|
|
@@ -38,7 +38,7 @@ const frontmatter: Frontmatter = {
|
|
|
38
38
|
const _ = Lang(lang);
|
|
39
39
|
|
|
40
40
|
// Logic
|
|
41
|
-
const
|
|
41
|
+
const accelerator = new Accelerator(SITE);
|
|
42
42
|
|
|
43
43
|
type CacheData = {
|
|
44
44
|
posts: MarkdownInstance[];
|
|
@@ -86,7 +86,7 @@ export async function getStaticPaths({ paginate }: any) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// Page Links
|
|
89
|
-
const pageLinks = paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
89
|
+
const pageLinks = accelerator.paging.links(SITE.pageLinks, page.lastPage, page.currentPage, page.url.current);
|
|
90
90
|
---
|
|
91
91
|
<Default frontmatter={ frontmatter } headings={ headings }>
|
|
92
92
|
<h2>{ _(Translations.articles.page_title).replace('{n}', page.currentPage.toString())}</h2>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import type { MarkdownInstance } from 'astro';
|
|
5
5
|
import { SITE } from '@config';
|
|
@@ -14,8 +14,7 @@ type Props = {
|
|
|
14
14
|
const { lang, posts } = Astro.props as Props;
|
|
15
15
|
|
|
16
16
|
// Logic
|
|
17
|
-
const
|
|
18
|
-
const markdown = new Markdown();
|
|
17
|
+
const accelerator = new Accelerator(SITE);
|
|
19
18
|
|
|
20
19
|
type ImageInfo = {
|
|
21
20
|
src: string;
|
|
@@ -40,7 +39,7 @@ const articles: Article[] = [];
|
|
|
40
39
|
for (let p of posts) {
|
|
41
40
|
const item = {
|
|
42
41
|
url: p.url ?? '',
|
|
43
|
-
title: await markdown.getTextFrom(p.frontmatter.title),
|
|
42
|
+
title: await accelerator.markdown.getTextFrom(p.frontmatter.title),
|
|
44
43
|
frontmatter: p.frontmatter,
|
|
45
44
|
img: p.frontmatter.bannerImage
|
|
46
45
|
? getImageInfo(p.frontmatter.bannerImage.src, '', SITE.images.listerSize)
|
|
@@ -60,7 +59,7 @@ function getLoadingAttribute() {
|
|
|
60
59
|
---
|
|
61
60
|
<ul class="post-list anim-show-parent">
|
|
62
61
|
{articles.map((post) => (
|
|
63
|
-
<li class="list-item" data-destination={ urlFormatter.addSlashToAddress(post.url) } data-image={ (post.frontmatter.bannerImage?.src.length > 0).toString() }>
|
|
62
|
+
<li class="list-item" data-destination={ accelerator.urlFormatter.addSlashToAddress(post.url) } data-image={ (post.frontmatter.bannerImage?.src.length > 0).toString() }>
|
|
64
63
|
<article>
|
|
65
64
|
<div class="list-item-image">
|
|
66
65
|
{post.img && (
|
|
@@ -77,7 +76,7 @@ function getLoadingAttribute() {
|
|
|
77
76
|
</div>
|
|
78
77
|
<div class="list-item-content">
|
|
79
78
|
<h3>
|
|
80
|
-
<a href={ urlFormatter.addSlashToAddress(post.url) }>{ post.title }</a>
|
|
79
|
+
<a href={ accelerator.urlFormatter.addSlashToAddress(post.url) }>{ post.title }</a>
|
|
81
80
|
</h3>
|
|
82
81
|
<AuthorsMini lang={ lang } frontmatter={ post.frontmatter as Frontmatter } />
|
|
83
82
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import { Translations, Lang } from '@util/Languages';
|
|
@@ -16,13 +16,9 @@ const { lang, frontmatter } = Astro.props as Props;
|
|
|
16
16
|
const _ = Lang(lang);
|
|
17
17
|
|
|
18
18
|
// Logic
|
|
19
|
-
const
|
|
20
|
-
const posts = new Posts(cache);
|
|
21
|
-
const authors = new Authors(posts);
|
|
22
|
-
const dateFormatter = new DateFormatter(SITE.dateOptions);
|
|
23
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
19
|
+
const accelerator = new Accelerator(SITE);
|
|
24
20
|
|
|
25
|
-
const authorList = authors.forPost(frontmatter);
|
|
21
|
+
const authorList = accelerator.authors.forPost(frontmatter);
|
|
26
22
|
|
|
27
23
|
// Get image info
|
|
28
24
|
const authorImage = authorList?.image?.src
|
|
@@ -42,16 +38,16 @@ const authorImage = authorList?.image?.src
|
|
|
42
38
|
<div class="author-info">
|
|
43
39
|
<span>{ _(Translations.post.written_by) }
|
|
44
40
|
{authorList.mainAuthor &&
|
|
45
|
-
<a href={ urlFormatter.addSlashToAddress(authorList.mainAuthor.url) + '1/' } itemprop="author">{ authorList.mainAuthor.frontmatter.title }</a>
|
|
41
|
+
<a href={ accelerator.urlFormatter.addSlashToAddress(authorList.mainAuthor.url) + '1/' } itemprop="author">{ authorList.mainAuthor.frontmatter.title }</a>
|
|
46
42
|
}{authorList.contributors.map((writer) => (
|
|
47
|
-
<a href={ urlFormatter.addSlashToAddress(writer.url) + '1/' } itemprop="contributor">{ writer.frontmatter.title }</a>
|
|
43
|
+
<a href={ accelerator.urlFormatter.addSlashToAddress(writer.url) + '1/' } itemprop="contributor">{ writer.frontmatter.title }</a>
|
|
48
44
|
))}.
|
|
49
45
|
<br /><time datetime={ frontmatter.pubDate.toString() } itemprop="datePublished">
|
|
50
|
-
{ dateFormatter.formatDate(frontmatter.pubDate, lang) }
|
|
46
|
+
{ accelerator.dateFormatter.formatDate(frontmatter.pubDate, lang) }
|
|
51
47
|
</time>
|
|
52
48
|
{frontmatter.modDate &&
|
|
53
49
|
<br /><time datetime={ frontmatter.modDate.toString() } itemprop="dateModified">
|
|
54
|
-
{ _(Translations.post.last_modified) } { dateFormatter.formatDate(frontmatter.modDate, lang) }
|
|
50
|
+
{ _(Translations.post.last_modified) } { accelerator.dateFormatter.formatDate(frontmatter.modDate, lang) }
|
|
55
51
|
</time>
|
|
56
52
|
}
|
|
57
53
|
</span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import { Translations, Lang } from '@util/Languages';;
|
|
@@ -15,12 +15,9 @@ const { lang, frontmatter } = Astro.props as Props;
|
|
|
15
15
|
const _ = Lang(lang);
|
|
16
16
|
|
|
17
17
|
// Logic
|
|
18
|
-
const
|
|
19
|
-
const posts = new Posts(cache);
|
|
20
|
-
const authors = new Authors(posts);
|
|
21
|
-
const dateFormatter = new DateFormatter(SITE.dateOptions);
|
|
18
|
+
const accelerator = new Accelerator(SITE);
|
|
22
19
|
|
|
23
|
-
const authorList = authors.forPost(frontmatter);
|
|
20
|
+
const authorList = accelerator.authors.forPost(frontmatter);
|
|
24
21
|
---
|
|
25
22
|
{authorList.writers.length > 0 &&
|
|
26
23
|
<div class="post-meta">
|
|
@@ -30,7 +27,7 @@ const authorList = authors.forPost(frontmatter);
|
|
|
30
27
|
<span>{ writer.frontmatter.title }</span>
|
|
31
28
|
))}.<br />
|
|
32
29
|
<time datetime={ frontmatter.pubDate.toString() }>
|
|
33
|
-
{ dateFormatter.formatDate(frontmatter.pubDate, lang) }
|
|
30
|
+
{ accelerator.dateFormatter.formatDate(frontmatter.pubDate, lang) }
|
|
34
31
|
</time>
|
|
35
32
|
</span>
|
|
36
33
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import { Translations, Lang } from '@util/Languages';
|
|
@@ -16,20 +16,17 @@ const { lang } = Astro.props as Props;
|
|
|
16
16
|
const _ = Lang(lang);
|
|
17
17
|
|
|
18
18
|
// Logic
|
|
19
|
-
const
|
|
20
|
-
const posts = new Posts(cache);
|
|
21
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
22
|
-
const navigation = new Navigation(posts, urlFormatter);
|
|
19
|
+
const accelerator = new Accelerator(SITE);
|
|
23
20
|
|
|
24
21
|
const currentUrl = new URL(Astro.request.url);
|
|
25
|
-
const navPages = navigation.breadcrumbs(currentUrl, SITE.subfolder);
|
|
22
|
+
const navPages = accelerator.navigation.breadcrumbs(currentUrl, SITE.subfolder);
|
|
26
23
|
---
|
|
27
24
|
<nav class="site-breadcrumbs" aria-label={ _(Translations.aria.breadcrumbs) }>
|
|
28
25
|
<ol vocab="http://schema.org/" typeof="BreadcrumbList">
|
|
29
26
|
{navPages.map((page, index) => (
|
|
30
27
|
<li property="itemListElement" typeof="ListItem">
|
|
31
28
|
<meta property="position" content={ index.toString() } />
|
|
32
|
-
<a property="item" typeof="WebPage" href={ urlFormatter.addSlashToAddress(page.url) } aria-current={ page.ariaCurrent } rel={ page.rel }><span property="name">{ page.title }</span></a>
|
|
29
|
+
<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>
|
|
33
30
|
</li>
|
|
34
31
|
))}
|
|
35
32
|
</ol>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import { Translations, Lang } from '@util/Languages';
|
|
@@ -18,8 +18,10 @@ const { lang } = Astro.props as Props;
|
|
|
18
18
|
const _ = Lang(lang);
|
|
19
19
|
|
|
20
20
|
// Logic
|
|
21
|
+
const accelerator = new Accelerator(SITE);
|
|
22
|
+
|
|
21
23
|
const currentUrl = new URL(Astro.request.url);
|
|
22
|
-
const pages =
|
|
24
|
+
const pages = accelerator.navigation.footer(currentUrl, _, Translations, SITE.subfolder, menu);
|
|
23
25
|
---
|
|
24
26
|
<footer class="site-footer" id="site-footer">
|
|
25
27
|
<div class="footer-columns">
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { PostFiltering,
|
|
2
|
+
import { PostFiltering, Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import { Translations, Lang } from '@util/Languages';
|
|
@@ -16,11 +16,9 @@ const { lang } = Astro.props as Props;
|
|
|
16
16
|
const _ = Lang(lang);
|
|
17
17
|
|
|
18
18
|
// Logic
|
|
19
|
-
const
|
|
20
|
-
const posts = new Posts(cache);
|
|
21
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
19
|
+
const accelerator = new Accelerator(SITE);
|
|
22
20
|
|
|
23
|
-
const search = posts.all().filter(PostFiltering.isSearch).shift() ?? null;
|
|
21
|
+
const search = accelerator.posts.all().filter(PostFiltering.isSearch).shift() ?? null;
|
|
24
22
|
---
|
|
25
23
|
<header class="site-header">
|
|
26
24
|
<a href="#site-nav" class="navigation-icon" title={ _(Translations.header.open_menu) }><svg xmlns="http://www.w3.org/2000/svg"
|
|
@@ -33,7 +31,7 @@ const search = posts.all().filter(PostFiltering.isSearch).shift() ?? null;
|
|
|
33
31
|
</svg></a>
|
|
34
32
|
<a href={ (SITE.subfolder ?? '') + '/' } class="site-title" translate="no">{ SITE.title }</a>
|
|
35
33
|
{search != null &&
|
|
36
|
-
<a href={ urlFormatter.addSlashToAddress(search.url) } class="search-icon" title={ _(Translations.header.open_search) }><svg xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
<a href={ accelerator.urlFormatter.addSlashToAddress(search.url) } class="search-icon" title={ _(Translations.header.open_search) }><svg xmlns="http://www.w3.org/2000/svg"
|
|
37
35
|
width="40" height="40" viewBox="0 0 24 24" stroke-width="1"
|
|
38
36
|
fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
39
37
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE, OPEN_GRAPH, HEADER_SCRIPTS } from '@config';
|
|
5
5
|
|
|
@@ -12,15 +12,14 @@ type Props = {
|
|
|
12
12
|
const { frontmatter } = Astro.props;
|
|
13
13
|
|
|
14
14
|
// Logic
|
|
15
|
-
const
|
|
16
|
-
const markdown = new Markdown();
|
|
15
|
+
const accelerator = new Accelerator(SITE);
|
|
17
16
|
|
|
18
17
|
const imageSrc = frontmatter.bannerImage?.src ?? OPEN_GRAPH.image.src;
|
|
19
18
|
const imageAlt = frontmatter.bannerImage?.alt ?? OPEN_GRAPH.image.alt;
|
|
20
19
|
const robots = frontmatter.robots ?? 'index, follow';
|
|
21
20
|
const canonicalImageSrc = new URL(imageSrc, Astro.site);
|
|
22
|
-
const canonicalURL = urlFormatter.addSlashToUrl(new URL(Astro.url.pathname, Astro.site + SITE.subfolder));
|
|
23
|
-
const socialTitle = await markdown.getTextFrom(frontmatter.title);
|
|
21
|
+
const canonicalURL = accelerator.urlFormatter.addSlashToUrl(new URL(Astro.url.pathname, Astro.site + SITE.subfolder));
|
|
22
|
+
const socialTitle = await accelerator.markdown.getTextFrom(frontmatter.title);
|
|
24
23
|
const title = `${ socialTitle } | ${ SITE.title }`;
|
|
25
24
|
---
|
|
26
25
|
<head>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import { Translations, Lang } from '@util/Languages';
|
|
4
4
|
import NavigationItem from '@components/NavigationItem.astro';
|
|
5
5
|
import { SITE } from '@config';
|
|
@@ -15,13 +15,10 @@ const { lang } = Astro.props as Props;
|
|
|
15
15
|
const _ = Lang(lang);
|
|
16
16
|
|
|
17
17
|
// Logic
|
|
18
|
-
const
|
|
19
|
-
const posts = new Posts(cache);
|
|
20
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
21
|
-
const navigation = new Navigation(posts, urlFormatter);
|
|
18
|
+
const accelerator = new Accelerator(SITE);
|
|
22
19
|
|
|
23
20
|
const currentUrl = new URL(Astro.request.url);
|
|
24
|
-
const pages = navigation.menu(currentUrl, SITE.subfolder, menu);
|
|
21
|
+
const pages = accelerator.navigation.menu(currentUrl, SITE.subfolder, menu);
|
|
25
22
|
---
|
|
26
23
|
<nav class="site-nav" id="site-nav" aria-label={ _(Translations.aria.site_navigation) }>
|
|
27
24
|
<h2 class="site-nav-title">{ _(Translations.navigation.title) }</h2>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import { Translations, Lang } from '@util/Languages';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import { menu } from '@data/navigation';
|
|
@@ -14,13 +14,10 @@ const { lang } = Astro.props as Props;
|
|
|
14
14
|
const _ = Lang(lang);
|
|
15
15
|
|
|
16
16
|
// Logic
|
|
17
|
-
const
|
|
18
|
-
const posts = new Posts(cache);
|
|
19
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
20
|
-
const navigation = new Navigation(posts, urlFormatter);
|
|
17
|
+
const accelerator = new Accelerator(SITE);
|
|
21
18
|
|
|
22
19
|
const currentUrl = new URL(Astro.request.url);
|
|
23
|
-
const pages = navigation.menu(currentUrl, SITE.subfolder, menu);
|
|
20
|
+
const pages = accelerator.navigation.menu(currentUrl, SITE.subfolder, menu);
|
|
24
21
|
---
|
|
25
22
|
<nav class="site-nav-bar" id="site-nav" aria-label={ _(Translations.aria.site_navigation) }>
|
|
26
23
|
<h2 class="site-nav-title">{ _(Translations.navigation.title) }</h2>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { NavPage } from 'astro-accelerator-utils/types/NavPage';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
|
|
@@ -11,11 +11,11 @@ type Props = {
|
|
|
11
11
|
const { lang, page } = Astro.props as Props;
|
|
12
12
|
|
|
13
13
|
// Logic
|
|
14
|
-
const
|
|
14
|
+
const accelerator = new Accelerator(SITE);
|
|
15
15
|
---
|
|
16
16
|
{(page.children.length == 0) && (
|
|
17
17
|
<li>
|
|
18
|
-
<a href={ urlFormatter.addSlashToAddress(page.url) } aria-current={ page.ariaCurrent } rel={ page.rel }>{ page.title }</a>
|
|
18
|
+
<a href={ accelerator.urlFormatter.addSlashToAddress(page.url) } aria-current={ page.ariaCurrent } rel={ page.rel }>{ page.title }</a>
|
|
19
19
|
</li>
|
|
20
20
|
)}
|
|
21
21
|
{(page.children.length > 0) && (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
3
|
-
import type { Link } from 'astro-accelerator-utils/
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
|
+
import type { Link } from 'astro-accelerator-utils/lib/v1/paging.mjs';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import type { MarkdownInstance, Page } from 'astro';
|
|
6
6
|
import { Translations, Lang } from '@util/Languages';
|
|
@@ -17,16 +17,16 @@ const { lang, page, pageLinks } = Astro.props as Props;
|
|
|
17
17
|
const _ = Lang(lang);
|
|
18
18
|
|
|
19
19
|
// Logic
|
|
20
|
-
const
|
|
20
|
+
const accelerator = new Accelerator(SITE);
|
|
21
21
|
---
|
|
22
22
|
<nav class="post-paging" aria-label={ _(Translations.aria.paging) }>
|
|
23
23
|
{page.url.prev
|
|
24
|
-
? <a href={ urlFormatter.addSlashToAddress(page.url.prev) }>{ _(Translations.articles.previous) }</a>
|
|
24
|
+
? <a href={ accelerator.urlFormatter.addSlashToAddress(page.url.prev) }>{ _(Translations.articles.previous) }</a>
|
|
25
25
|
: <span>{ _(Translations.articles.previous) }</span>}
|
|
26
26
|
{pageLinks.map((link) => (
|
|
27
|
-
<a href={ urlFormatter.addSlashToAddress(link.url) } aria-current={ link.ariaCurrent } class={ link.class }>{ link.title }</a>
|
|
27
|
+
<a href={ accelerator.urlFormatter.addSlashToAddress(link.url) } aria-current={ link.ariaCurrent } class={ link.class }>{ link.title }</a>
|
|
28
28
|
))}
|
|
29
29
|
{page.url.next
|
|
30
|
-
? <a href={ urlFormatter.addSlashToAddress(page.url.next) }>{ _(Translations.articles.next) }</a>
|
|
30
|
+
? <a href={ accelerator.urlFormatter.addSlashToAddress(page.url.next) }>{ _(Translations.articles.next) }</a>
|
|
31
31
|
: <span>{ _(Translations.articles.next) }</span>}
|
|
32
32
|
</nav>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import { PostFiltering, PostOrdering,
|
|
2
|
+
import { PostFiltering, PostOrdering, Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import type { MarkdownInstance } from 'astro';
|
|
@@ -16,15 +16,13 @@ type Props = {
|
|
|
16
16
|
const { lang, frontmatter, headings } = Astro.props as Props;
|
|
17
17
|
|
|
18
18
|
// Logic
|
|
19
|
-
const
|
|
20
|
-
const posts = new Posts(cache);
|
|
21
|
-
const urlFormatter = new UrlFormatter(SITE.url);
|
|
19
|
+
const accelerator = new Accelerator(SITE);
|
|
22
20
|
|
|
23
21
|
let relatedPosts: MarkdownInstance<Record<string, any>>[] = [];
|
|
24
22
|
const parentCagory = (frontmatter.categories ?? [null])[0];
|
|
25
23
|
|
|
26
24
|
if (parentCagory != null) {
|
|
27
|
-
const allPages = posts.all().filter(PostFiltering.isListable);
|
|
25
|
+
const allPages = accelerator.posts.all().filter(PostFiltering.isListable);
|
|
28
26
|
const allPosts = allPages
|
|
29
27
|
.filter(p => p.frontmatter.title != frontmatter.title && p.frontmatter.categories && p.frontmatter.categories.includes(parentCagory))
|
|
30
28
|
.sort(PostOrdering.sortByPubDateDesc)
|
|
@@ -57,7 +55,7 @@ const articles = relatedPosts.map(p => {
|
|
|
57
55
|
{articles.length > 0 &&
|
|
58
56
|
<ul class="post-list anim-show-parent">
|
|
59
57
|
{articles.map((post) => (
|
|
60
|
-
<li class="list-item" data-destination={ urlFormatter.addSlashToAddress(post.url) } data-image={ (post.frontmatter.bannerImage?.src.length > 0).toString() }>
|
|
58
|
+
<li class="list-item" data-destination={ accelerator.urlFormatter.addSlashToAddress(post.url) } data-image={ (post.frontmatter.bannerImage?.src.length > 0).toString() }>
|
|
61
59
|
<article>
|
|
62
60
|
<div class="list-item-image">
|
|
63
61
|
{post.img && (
|
|
@@ -72,7 +70,7 @@ const articles = relatedPosts.map(p => {
|
|
|
72
70
|
</div>
|
|
73
71
|
<div class="list-item-content">
|
|
74
72
|
<h3>
|
|
75
|
-
<a href={ urlFormatter.addSlashToAddress(post.url) }>{ post.frontmatter.title }</a>
|
|
73
|
+
<a href={ accelerator.urlFormatter.addSlashToAddress(post.url) }>{ post.frontmatter.title }</a>
|
|
76
74
|
</h3>
|
|
77
75
|
<AuthorsMini lang={ lang } frontmatter={ post.frontmatter as Frontmatter } />
|
|
78
76
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { Translations, Lang } from '@util/Languages';
|
|
5
5
|
import { SITE } from '@config';
|
|
@@ -15,10 +15,12 @@ const { lang, frontmatter } = Astro.props as Props;
|
|
|
15
15
|
const _ = Lang(lang);
|
|
16
16
|
|
|
17
17
|
// Logic
|
|
18
|
+
const accelerator = new Accelerator(SITE);
|
|
19
|
+
|
|
18
20
|
const categories = frontmatter.categories ?? [];
|
|
19
21
|
const tags = frontmatter.tags ?? [];
|
|
20
22
|
|
|
21
|
-
const links =
|
|
23
|
+
const links = accelerator.taxonomy.links(Translations, _, SITE.subfolder);
|
|
22
24
|
const hasTaxonomy = (categories.length + tags.length) > 0;
|
|
23
25
|
---
|
|
24
26
|
{hasTaxonomy && (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import Redirect from './Redirect.astro';
|
|
@@ -13,10 +13,10 @@ const { frontmatter, headings } = Astro.props as Props;
|
|
|
13
13
|
const lang = frontmatter.lang ?? SITE.default.lang;
|
|
14
14
|
|
|
15
15
|
// Logic
|
|
16
|
-
const
|
|
16
|
+
const accelerator = new Accelerator(SITE);
|
|
17
17
|
const redirectFrontmatter = {
|
|
18
18
|
...frontmatter,
|
|
19
|
-
redirect: urlFormatter.addSlashToAddress(Astro.request.url) + '1/'
|
|
19
|
+
redirect: accelerator.urlFormatter.addSlashToAddress(Astro.request.url) + '1/'
|
|
20
20
|
};
|
|
21
21
|
---
|
|
22
22
|
<Redirect frontmatter={ redirectFrontmatter } headings={ headings } />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
2
|
+
import { Accelerator } from 'astro-accelerator-utils';
|
|
3
3
|
import type { Frontmatter } from 'astro-accelerator-utils/types/Frontmatter';
|
|
4
4
|
import { SITE } from '@config';
|
|
5
5
|
import Head from '@components/HtmlHead.astro';
|
|
@@ -23,11 +23,11 @@ const lang = frontmatter.lang ?? SITE.default.lang;
|
|
|
23
23
|
const textDirection = frontmatter.dir ?? SITE.default.dir;
|
|
24
24
|
|
|
25
25
|
// Logic
|
|
26
|
-
const
|
|
26
|
+
const accelerator = new Accelerator(SITE);
|
|
27
27
|
|
|
28
|
-
const title = await markdown.getInlineHtmlFrom(frontmatter.title ?? SITE.title);
|
|
28
|
+
const title = await accelerator.markdown.getInlineHtmlFrom(frontmatter.title ?? SITE.title);
|
|
29
29
|
const subtitle = frontmatter.subtitle
|
|
30
|
-
? await markdown.getInlineHtmlFrom(frontmatter.subtitle)
|
|
30
|
+
? await accelerator.markdown.getInlineHtmlFrom(frontmatter.subtitle)
|
|
31
31
|
: null;
|
|
32
32
|
|
|
33
33
|
const site_url = SITE.url;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// warning: This file is overwritten by Astro Accelerator
|
|
3
|
-
|
|
4
|
-
import { getData } from './[page].astro';
|
|
5
|
-
import Redirect from 'src/layouts/Redirect.astro'
|
|
6
|
-
|
|
7
|
-
export async function getStaticPaths() {
|
|
8
|
-
let data = await getData();
|
|
9
|
-
|
|
10
|
-
return data.tags.map(item => {
|
|
11
|
-
return { params: { tag: item.toLowerCase().replace(' ', '-') }}
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const frontmatter = {
|
|
16
|
-
redirect: './1/'
|
|
17
|
-
} as any;
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
<Redirect frontmatter={ frontmatter } headings={ [] } />
|