Skip to content

Commit

Permalink
feat(BaseHead): Add preconnects and update CSP
Browse files Browse the repository at this point in the history
This commit adds preconnect links to improve performance by establishing early connections with external resources. Additionally, the Content-Security-Policy (CSP) has been updated to allow loading of fonts from the Google Fonts API over HTTPS.
  • Loading branch information
SakuraIsayeki committed Jun 22, 2024
1 parent f608b0f commit c8b2eb8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion nodsoft_moltenobsidian_web/src/components/BaseHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,21 @@ const base = import.meta.env.BASE_URL ?? "/";
<meta name="theme-color" content="#ffffff" />
<meta name="generator" content={Astro.generator} />

<!-- Preconnects -->
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin="anonymous" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />

<!-- CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' fonts.googleapis.com 'unsafe-inline'; font-src 'self' fonts.gstatic.com; img-src 'self' data:; script-src 'self' 'unsafe-inline';" />
<meta
http-equiv="Content-Security-Policy"
content="
default-src 'self';
style-src 'self' https://fonts.googleapis.com/ 'unsafe-inline';
font-src 'self' https://fonts.gstatic.com/;
img-src 'self' data:;
script-src 'self';
"
/>

<!-- Canonical URL -->
<!--<link rel="canonical" href={canonicalURL} />-->
Expand Down
2 changes: 1 addition & 1 deletion nodsoft_moltenobsidian_web/src/styles/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@import "./responsive";

@import url("//fonts.googleapis.com/css2?family=Nunito");
@import url("https://fonts.googleapis.com/css2?family=Nunito");

:root {
background: $background radial-gradient(ellipse farthest-corner at 0 140%, $accent-dark 0%, transparent 70%) no-repeat fixed left top;
Expand Down

0 comments on commit c8b2eb8

Please sign in to comment.