From f568888077cd5e925308b656f8d0b2f4bf02c698 Mon Sep 17 00:00:00 2001 From: schmelczerandras Date: Mon, 28 Sep 2020 17:07:32 +0200 Subject: [PATCH] Add 404 page and robots.txt --- custom.d.ts | 10 ++++++++++ package.json | 2 +- src/index.ts | 2 ++ src/no-change/404.html | 36 ++++++++++++++++++++++++++++++++++++ src/no-change/robots.txt | 2 ++ webpack.config.js | 4 ++-- 6 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 src/no-change/404.html create mode 100644 src/no-change/robots.txt diff --git a/custom.d.ts b/custom.d.ts index 4344da7..7d51401 100644 --- a/custom.d.ts +++ b/custom.d.ts @@ -14,3 +14,13 @@ declare module '*.jpeg' { const content: ResponsiveImage; export default content; } + +declare module '*.txt' { + const content: string; + export default content; +} + +declare module '*.html' { + const content: string; + export default content; +} diff --git a/package.json b/package.json index 75e960e..148d8a5 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "start": "webpack-dev-server --mode development", - "build": "webpack && find dist -type f -regex \".*\\(js\\|css\\|txt\\)\" | xargs rm" + "build": "webpack && find dist -type f -regex \".*\\(js\\|css\\|LICENSE.*\\)\" | xargs rm" }, "repository": { "type": "git", diff --git a/src/index.ts b/src/index.ts index 3af813f..84685e6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,6 @@ import './index.scss'; +import './no-change/404.html'; +import './no-change/robots.txt'; import { Photos } from './photos'; // @ts-ignore diff --git a/src/no-change/404.html b/src/no-change/404.html new file mode 100644 index 0000000..9177031 --- /dev/null +++ b/src/no-change/404.html @@ -0,0 +1,36 @@ + + + + + + Not found + + + + + +

The requested resource cannot be found.

+ + diff --git a/src/no-change/robots.txt b/src/no-change/robots.txt new file mode 100644 index 0000000..c2a49f4 --- /dev/null +++ b/src/no-change/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Allow: / diff --git a/webpack.config.js b/webpack.config.js index 6f7000c..2d527fc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -57,7 +57,7 @@ module.exports = { loader: 'responsive-loader', options: { adapter: Sharp, - quality: 90, + quality: 90, outputPath: 'static/', sizes: [300, 800, 1200, 2000], placeholder: false, @@ -116,7 +116,7 @@ module.exports = { }, }, { - test: /\.ico$/i, + test: /no-change.*(ico|html|txt)$/i, use: { loader: 'file-loader', query: {