astro-accelerator 0.0.21 → 0.0.23

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.21",
2
+ "version": "0.0.23",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  layout: src/layouts/Default.astro
3
- title: Welcome to Astro Accelerator
3
+ title: Welcome to Astro *Accelerator*
4
4
  subtitle: A *super-lightweight*, accessible, SEO-friendly starter project for Astro
5
5
  navTitle: Home
6
6
  navOrder: 0
@@ -1,10 +1,4 @@
1
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
2
  import { sortByPubDateDesc } from '@util/PageTypeFilters';
9
3
  import { getPages } from '@util/PageQueries';
10
4
 
@@ -1,10 +1,4 @@
1
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
2
  import { sortByPubDateDesc } from '@util/PageTypeFilters';
9
3
  import { getPages } from '@util/PageQueries';
10
4
 
@@ -1,11 +1,4 @@
1
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
2
  import { getPages } from '@util/PageQueries';
10
3
 
11
4
  // Logic
@@ -1,10 +1,4 @@
1
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
2
  import { sortByModDate } from '@util/PageTypeFilters';
9
3
  import { getPages } from '@util/PageQueries';
10
4
 
@@ -1,5 +1,4 @@
1
1
  ---
2
- import t from '@util/language.json';
3
2
  import { Lang } from '@util/Languages';
4
3
 
5
4
  import { getTaxonomy, taxonomyLinks, sortByTitle } from '@util/Taxonomy';
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import { SITE, OPEN_GRAPH, HEADER_SCRIPTS, Frontmatter } from '@config';
3
3
  import { addSlashToUrl } from '@util/Url';
4
+ import { getTextFrom } from '@util/Markdown';
4
5
 
5
6
  // Properties
6
7
  type Props = {
@@ -16,10 +17,11 @@ const imageAlt = frontmatter.bannerImage?.alt ?? OPEN_GRAPH.image.alt;
16
17
  const robots = frontmatter.robots ?? 'index, follow';
17
18
  const canonicalImageSrc = new URL(imageSrc, Astro.site);
18
19
  const canonicalURL = addSlashToUrl(new URL(Astro.url.pathname, Astro.site + SITE.subfolder));
20
+ const title = await getTextFrom( frontmatter.title ? `${ frontmatter.title } | ${ SITE.title }` : SITE.title);
19
21
  ---
20
22
  <head>
21
23
  <meta charset="utf-8" />
22
- <title>{ frontmatter.title ? `${ frontmatter.title } | ${ SITE.title }` : SITE.title }</title>
24
+ <title>{ title }</title>
23
25
  <meta name="robots" content={ 'max-image-preview:large, ' + robots }>
24
26
  <meta name="viewport" content="width=device-width, initial-scale=1">
25
27
  <meta name="keywords" content={ frontmatter.keywords }>
@@ -23,3 +23,8 @@ export async function getHtmlFrom(markdown: string): Promise<string> {
23
23
 
24
24
  return String(vfile);
25
25
  }
26
+
27
+ export async function getTextFrom(markdown: string): Promise<string> {
28
+ const html = await getInlineHtmlFrom(markdown);
29
+ return html.replace(/<.*?>/g, '');
30
+ }