Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/travolta.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/pages/404-page/index.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="{{ htmlWebpackPlugin.options.content.lang }}">
<head>
{{> ../../template-partials/meta pageTranslations=htmlWebpackPlugin.options.content.translations.about_us}}
{{> ../../template-partials/head}}
</head>
<body>
{{> ../../header/header }}
<main class="page-not-found">
<h1>
{{ lookup htmlWebpackPlugin.options.content.pageNotFound.title htmlWebpackPlugin.options.content.lang }}
</h1>
<h2>
{{ lookup htmlWebpackPlugin.options.content.pageNotFound.message htmlWebpackPlugin.options.content.lang }}
<i class="fa fa-face-frown"></i>
</h2>
<img src="/img/travolta.gif" alt="" />
</main>
{{> ../../footer/footer}}
</body>
</html>
2 changes: 2 additions & 0 deletions src/pages/404-page/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
('use strict');
import './index.scss';
27 changes: 27 additions & 0 deletions src/pages/404-page/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@import '../../styles/constants';
@import '../../styles/mixins';

.page-not-found {
text-align: center;
padding: 64px 16px 0;

h1,
h2 {
margin: 15px 0;
line-height: 1.1;
}

h1 {
font-size: 1.5em;
}

h2 {
font-size: 1em;
}

img {
vertical-align: top;
max-width: 360px;
width: 100%;
}
}
42 changes: 42 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,19 @@ const mediaMentionsConfig = [
];
const BASE_URL = 'https://programming.org.ua';

const pageNotFound = {
title: {
en: 'Four-zero-four',
uk: 'Чотири-нуль-чотири',
ru: 'Четыре-ноль-четыре',
},
message: {
en: 'You were looking for something we don’t have, or something that has been removed',
uk: 'Ви шукали те, чого в нас немає, або те, що було видалено',
ru: 'Вы искали то, чего у нас нет, или то, что было удалено',
},
};

module.exports = async (_, { mode = 'development' }) => ({
entry: {
common: './src/common.js',
Expand All @@ -328,11 +341,13 @@ module.exports = async (_, { mode = 'development' }) => ({
'anketa/last/index': './src/pages/sign-up-success-page/index.js',
'email-confirmed/index': './src/pages/sign-up-confirmation-page/index.js',
'supportus/index': './src/pages/support-us-page/index.js',
'404/index': './src/pages/404-page/index.js',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
clean: true,
publicPath: '/',
},
plugins: [
new SitemapPlugin({
Expand Down Expand Up @@ -553,6 +568,17 @@ module.exports = async (_, { mode = 'development' }) => ({
),
},
}),
new HtmlWebpackPlugin({
template: 'src/pages/404-page/index.hbs',
chunks: ['common', '404/index'],
inject: 'body',
minify: mode === 'production',
filename: `${filenamePrefix}404.html`,
content: {
...getCommonContent('/404/'),
pageNotFound,
},
}),
];
},
[]
Expand Down Expand Up @@ -606,6 +632,22 @@ module.exports = async (_, { mode = 'development' }) => ({
devServer: {
static: './dist',
hot: false,
historyApiFallback: {
rewrites: [
{
from: /^\/ru\/.*$/,
to: '/ru/404.html',
},
{
from: /^\/en\/.*$/,
to: '/en/404.html',
},
{
from: /^\/[^.]*$/,
to: '/404.html',
},
],
},
},
}),
...(mode === 'production' && {
Expand Down