File tree Expand file tree Collapse file tree 9 files changed +64
-14
lines changed
packages/visor/src/components Expand file tree Collapse file tree 9 files changed +64
-14
lines changed Original file line number Diff line number Diff line change 1
1
// @ts -check
2
- import { defineConfig } from ' astro/config' ;
2
+ import { defineConfig } from " astro/config" ;
3
3
4
4
// https://astro.build/config
5
5
export default defineConfig ( { } ) ;
Original file line number Diff line number Diff line change 12
12
"dependencies" : {
13
13
"astro" : " ^4.16.7" ,
14
14
"@astrojs/check" : " ^0.9.4" ,
15
- "typescript" : " ^5.6.3"
15
+ "typescript" : " ^5.6.3" ,
16
+ "@binz/visor" : " workspace:*"
16
17
}
17
18
}
Original file line number Diff line number Diff line change 1
1
---
2
+ import {Visor } from ' @binz/visor' ;
3
+ import logoSvgSrc from ' ../images/Logo.svg' ;
4
+
2
5
interface Props {
3
- title: string ;
6
+ title: string ;
4
7
}
5
8
6
- const { title } = Astro .props ;
9
+ const { title : pageTitle } = Astro .props ;
10
+ const canonicalUrl = Astro .url ; // requires `site` in astro.config.mjs
7
11
---
8
12
9
13
<!doctype html >
10
14
<html lang =" en" >
11
- <head >
12
- <meta charset =" UTF-8" />
13
- <meta name =" description" content =" Astro description" />
14
- <meta name =" viewport" content =" width=device-width" />
15
- <link rel =" icon" type =" image/svg+xml" href =" /favicon.svg" />
16
- <meta name =" generator" content ={ Astro .generator } />
17
- <title >{ title } </title >
18
- </head >
15
+ <Visor
16
+ author ={ {
17
+ name: " Joe Bloggs" ,
18
+ twitterHandle: " @joe_blogs"
19
+ }}
20
+ canonicalURL ={ canonicalUrl }
21
+ description =" Built with visor"
22
+ defaultKeywords ={ []}
23
+ siteName =" Example Site"
24
+ siteFaviconSvg ={ logoSvgSrc }
25
+ socialImagePath =" /social.jpg"
26
+ title ={ pageTitle }
27
+ />
19
28
<body >
20
29
<slot />
21
30
</body >
Original file line number Diff line number Diff line change
1
+ import type { APIRoute } from "astro" ;
2
+ import Favicon from "@binz/visor/src/lib/favicon" ;
3
+ import path from "node:path" ;
4
+
5
+ const faviconSrc = path . resolve ( "src/images/Logo.svg" ) ;
6
+
7
+ export const GET : APIRoute = Favicon ( { faviconSrc} ) ;
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import Card from '../components/Card.astro';
33
33
</linearGradient >
34
34
</defs >
35
35
</svg >
36
- <h1 >Welcome to <span class =" text-gradient" >Astro </span ></h1 >
36
+ <h1 >Welcome to <span class =" text-gradient" >Visor </span ></h1 >
37
37
<p class =" instructions" >
38
38
To get started, open the directory <code >src/pages</code > in your project.<br />
39
39
<strong >Code Challenge:</strong > Tweak the "Welcome to Astro" message above.
Original file line number Diff line number Diff line change
1
+ import path from "node:path" ;
2
+ import type { APIRoute } from "astro" ;
3
+ import Manifest from "@binz/visor/src/lib/manifest" ;
4
+
5
+ import favicon from "../images/favicon.ico" ;
6
+
7
+ const faviconPngSizes = [ 192 , 512 ] ;
8
+
9
+ export const GET : APIRoute = Manifest ( {
10
+ name : "Example Site" ,
11
+ description : "An example site" ,
12
+ start_url : "/" ,
13
+ display : "standalone" ,
14
+ id : "example-com" ,
15
+ background_color : "#FFFFFF" ,
16
+ theme_color : "#B9FF66" ,
17
+ favicon : {
18
+ src : favicon ,
19
+ faviconSizes : faviconPngSizes ,
20
+ } ,
21
+ } ) ;
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ const appleTouchIcon = await getImage({
66
66
})
67
67
// const faviconSvg = await getImage({ src: siteFaviconSvg, format: 'svg' })
68
68
69
- const canonicalImageSrc = new URL (socialImage , Astro . site );
69
+ const canonicalImageSrc = new URL (socialImage , canonicalURL )
70
70
const sanitizedDescription = description .replace (/ (<([^ >] + )>)/ gi , ' ' );
71
71
72
72
const keywords = Array .from (
You can’t perform that action at this time.
0 commit comments