diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..9fded1e --- /dev/null +++ b/.htaccess @@ -0,0 +1 @@ +ErrorDocument 404 /404.html \ No newline at end of file diff --git a/.idea/runConfigurations/serve.xml b/.idea/runConfigurations/serve.xml new file mode 100644 index 0000000..a24edbd --- /dev/null +++ b/.idea/runConfigurations/serve.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/build_extra.sh b/build_extra.sh new file mode 100644 index 0000000..7323a94 --- /dev/null +++ b/build_extra.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +if [ ! -e dist ]; then + echo "dist directory not found, running 'vite bulid'" + vite build +fi + +if [ -e robots.txt ]; then + cp robots.txt dist +else + echo "robots.txt not found" +fi + +mkdir -p "dist/.well-known" + +if [ -e "dist/.well-known" ]; then + if [ -e security.txt ]; then + cp security.txt dist/.well-known + else + echo "security.txt not found" + fi +fi + +if [ -e .htaccess ]; then + cp .htaccess dist +fi diff --git a/package.json b/package.json index 7aa299a..0c91e72 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "scripts": { "dev": "vite", - "build": "vite build", + "build": "vite build && sh build_extra.sh", "serve": "vite preview" }, "license": "MIT", diff --git a/postcss.config.js b/postcss.config.js index 7904127..824f185 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,5 +1,5 @@ module.exports = { - purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], + purge: ['./*.html', './src/**/*.{vue,js,ts,jsx,tsx}'], plugins: { tailwindcss: {}, autoprefixer: {}, diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..14267e9 --- /dev/null +++ b/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Allow: / \ No newline at end of file diff --git a/security.txt b/security.txt new file mode 100644 index 0000000..99fe47c --- /dev/null +++ b/security.txt @@ -0,0 +1,3 @@ +Contact: mailto:me@martials.no +Expires: 2030-12-31 +Preferred-Languages: no \ No newline at end of file diff --git a/src/404.tsx b/src/404.tsx new file mode 100644 index 0000000..0a6089b --- /dev/null +++ b/src/404.tsx @@ -0,0 +1,22 @@ +/* @refresh reload */ +import { type Component } from "solid-js"; +import { render } from "solid-js/web"; +import Layout from "./components/layout"; +import { Link } from "./components/link"; + +const PageNotFound: Component = () => { + return ( + +
+

Error 404 - Siden ble ikke funnet

+

+ + Gå tilbake til forsiden + +

+
+
+ ); +}; + +render(() => , document.getElementById("root") as HTMLElement); diff --git a/tailwind.config.js b/tailwind.config.js index c538530..9ac63e9 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,7 +1,7 @@ /** @type {import('tailwindcss').Config} */ module.exports = { content: [ - './index.html', + './index.html', "./404.html", './src/**/*.{js,ts,jsx,tsx,css,md,mdx,html,json,scss}', ], darkMode: 'class', diff --git a/vite.config.ts b/vite.config.ts index 3d8b8d5..bd7292d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,5 +8,11 @@ export default defineConfig({ }, build: { target: 'esnext', + rollupOptions: { + input: { + main: "index.html", + "404": "404.html", + } + } }, });