diff --git a/firebase.json b/firebase.json index e782939..16752f2 100644 --- a/firebase.json +++ b/firebase.json @@ -1,10 +1,44 @@ { "hosting": { "public": "public", - "ignore": [ - "firebase.json", - "**/.*", - "**/node_modules/**" + "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], + "headers": [ + { + "source": "**/*.html", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=0, must-revalidate" + } + ] + }, + { + "source": "page-data/**", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=0, must-revalidate" + } + ] + }, + { + "source": "static/**", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + }, + { + "source": "**/*.@(js|css)", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + } ] } } diff --git a/gatsby-browser.js b/gatsby-browser.js index 9ef9394..3886d57 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -1,10 +1,10 @@ // custom typefaces -import "@fontsource/inter/400.css" -import "@fontsource/inter/500.css" -import "@fontsource/inter/700.css" -import "@fontsource/jetbrains-mono/400.css" -import "@fontsource/jetbrains-mono/500.css" -import "@fontsource/jetbrains-mono/700.css" +import "@fontsource/inter/latin-400.css" +import "@fontsource/inter/latin-500.css" +import "@fontsource/inter/latin-700.css" +import "@fontsource/jetbrains-mono/latin-400.css" +import "@fontsource/jetbrains-mono/latin-500.css" +import "@fontsource/jetbrains-mono/latin-700.css" // custom CSS styles import "./src/style.css" diff --git a/gatsby-ssr.js b/gatsby-ssr.js index b66a6d9..0fcdbd2 100644 --- a/gatsby-ssr.js +++ b/gatsby-ssr.js @@ -10,3 +10,23 @@ exports.onRenderBody = ({ setHeadComponents }) => { />, ]) } + +// Gatsby inlines the full stylesheet into every page's . Link the +// cacheable styles..css instead so each page doesn't re-ship it. +exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => { + if (process.env.NODE_ENV !== "production") return + + replaceHeadComponents( + getHeadComponents().map(el => + el.type === "style" && el.props["data-href"] ? ( + + ) : ( + el + ), + ), + ) +} diff --git a/src/pages/404.js b/src/pages/404.js deleted file mode 100644 index 107f6f2..0000000 --- a/src/pages/404.js +++ /dev/null @@ -1,29 +0,0 @@ -import * as React from "react" -import { graphql } from "gatsby" - -import Layout from "../layouts/base" -import Seo from "../components/seo" - -const NotFoundPage = ({ data, location }) => { - const siteTitle = data.site.siteMetadata.title - - return ( - - -

404: Not Found

-

You just hit a route that doesn't exist... the sadness.

-
- ) -} - -export default NotFoundPage - -export const pageQuery = graphql` - query { - site { - siteMetadata { - title - } - } - } -` diff --git a/static/404.html b/static/404.html new file mode 100644 index 0000000..5a89e00 --- /dev/null +++ b/static/404.html @@ -0,0 +1,22 @@ + + + + + + +404: Not Found | happy PHP dev + + + +
+

404: Not Found

+

You just hit a route that doesn't exist... the sadness.

+

Back to the homepage

+
+ + diff --git a/static/robots.txt b/static/robots.txt index eb05362..7fb76ac 100644 --- a/static/robots.txt +++ b/static/robots.txt @@ -1,2 +1,12 @@ User-agent: * Disallow: + +User-agent: GPTBot +User-agent: CCBot +User-agent: ClaudeBot +User-agent: anthropic-ai +User-agent: Bytespider +User-agent: PerplexityBot +User-agent: Amazonbot +User-agent: meta-externalagent +Disallow: /