Skip to content

Commit f531ec1

Browse files
committed
Add separate index at /en
1 parent 503844a commit f531ec1

File tree

7 files changed

+93
-5
lines changed

7 files changed

+93
-5
lines changed

config/paths.js

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ module.exports = {
5555
appBuild: resolveApp('build'),
5656
appPublic: resolveApp('public'),
5757
appHtml: resolveApp('public/index.html'),
58+
appHtmlEn: resolveApp('public/en/index.html'),
5859
appIndexJs: resolveModule(resolveApp, 'src/index'),
5960
appPackageJson: resolveApp('package.json'),
6061
appSrc: resolveApp('src'),

config/webpack.config.js

+26
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,32 @@ module.exports = function (webpackEnv) {
580580
: undefined
581581
)
582582
),
583+
new HtmlWebpackPlugin(
584+
Object.assign(
585+
{},
586+
{
587+
inject: true,
588+
template: paths.appHtmlEn,
589+
filename: 'en/index.html'
590+
},
591+
isEnvProduction
592+
? {
593+
minify: {
594+
removeComments: true,
595+
collapseWhitespace: true,
596+
removeRedundantAttributes: true,
597+
useShortDoctype: true,
598+
removeEmptyAttributes: true,
599+
removeStyleLinkTypeAttributes: true,
600+
keepClosingSlash: true,
601+
minifyJS: true,
602+
minifyCSS: true,
603+
minifyURLs: true,
604+
},
605+
}
606+
: undefined
607+
)
608+
),
583609
// Inlines the webpack runtime script. This script is too small to warrant
584610
// a network request.
585611
// https://github.com/facebook/create-react-app/issues/5358

public/en/index.html

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" />
6+
<meta name="theme-color" content="#0051A2" />
7+
<!--
8+
manifest.json provides metadata used when your web app is installed on a
9+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
10+
-->
11+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
12+
<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/apple-touch-icon.png">
13+
<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicon-32x32.png">
14+
<link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicon-16x16.png">
15+
<!--
16+
Notice the use of %PUBLIC_URL% in the tags above.
17+
It will be replaced with the URL of the `public` folder during the build.
18+
Only files inside the `public` folder can be referenced from the HTML.
19+
20+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
21+
work correctly both with client-side routing and a non-root public URL.
22+
Learn how to configure a non-root public URL by running `npm run build`.
23+
-->
24+
25+
<!-- Primary Meta Tags -->
26+
<title>COVID-19 | Restrictions generator</title>
27+
<meta name="title" content="COVID-19 | Restrictions generator">
28+
<meta name="description" content="Rząd wprowadził nowe obostrzenia w związku z pandemią koronawirusa. Sprawdź, co dzisiaj wolno, a czego nie.">
29+
30+
<!-- Open Graph / Facebook -->
31+
<meta property="og:type" content="website">
32+
<meta property="og:url" content="%PUBLIC_URL%/">
33+
<meta property="og:title" content="COVID-19 | Restrictions generator">
34+
<meta property="og:description" content="Rząd wprowadził nowe obostrzenia w związku z pandemią koronawirusa. Sprawdź, co dzisiaj wolno, a czego nie.">
35+
<meta property="og:image" content="%PUBLIC_URL%/og_image.jpg">
36+
<meta property="og:locale" content="pl_PL" />
37+
38+
<!-- Twitter -->
39+
<meta property="twitter:card" content="summary_large_image">
40+
<meta property="twitter:url" content="%PUBLIC_URL%/">
41+
<meta property="twitter:title" content="COVID-19 | Restrictions generator">
42+
<meta property="twitter:description" content="Rząd wprowadził nowe obostrzenia w związku z pandemią koronawirusa. Sprawdź, co dzisiaj wolno, a czego nie.">
43+
<meta property="twitter:image" content="%PUBLIC_URL%/og_image.jpg">
44+
<meta property="twitter:locale" content="pl_PL" />
45+
</head>
46+
<body>
47+
<noscript>You need to enable JavaScript to run this app.</noscript>
48+
<div id="root"></div>
49+
<!--
50+
This HTML file is a template.
51+
If you open it directly in the browser, you will see an empty page.
52+
53+
You can add webfonts, meta tags, or analytics to this file.
54+
The build step will place the bundled scripts into the <body> tag.
55+
56+
To begin the development, run `npm start` or `yarn start`.
57+
To create a production bundle, use `npm run build` or `yarn build`.
58+
-->
59+
<script src="https://polyfill.io/v3/polyfill.min.js?features=es2015%2Ces2016%2Ces2017%2Ces2018%2Ces2019%2Ces5%2Ces6%2Ces7"></script>
60+
</body>
61+
</html>

src/generation-logic/generate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const QUARANTINE_MAX = 14;
66

77
let data = null;
88

9-
const dataPath = `lolcontent/${chooseLanguage()}.tsv`
9+
const dataPath = `${window.location.origin}/lolcontent/${chooseLanguage()}.tsv`
1010

1111
let xhr = new XMLHttpRequest();
1212
xhr.open("GET", dataPath, true);

src/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { IntlProvider } from 'react-intl';
88
import { chooseLanguage } from './utils'
99

1010
const language = chooseLanguage()
11-
const messagesPath = `messages/${language}.json`;
11+
const messagesPath = `${window.location.origin}/messages/${language}.json`;
1212

1313
fetch(messagesPath)
1414
.then(response => response.json())

src/ui/AppFooter.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const GithubIcon = styled.span`
5050
display: inline-block;
5151
width: 15px;
5252
height: 1em;
53-
background-image: url('github.svg');
53+
background-image: url('/github.svg');
5454
background-position: center;
5555
background-repeat: no-repeat;
5656
`
@@ -59,7 +59,7 @@ const StarIcon = styled.span`
5959
display: inline-block;
6060
width: 15px;
6161
height: 1em;
62-
background-image: url('star.svg');
62+
background-image: url('/star.svg');
6363
background-position: center;
6464
background-repeat: no-repeat;
6565
`

src/ui/AppHeader.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const AppHeader = ({ }) => (
129129
<TopBarText><FormattedMessage id="topBar" /></TopBarText>
130130
</TopBar>
131131
<LogoContainer>
132-
<Logo src="logo.jpg" />
132+
<Logo src="/logo.jpg" />
133133
<Header>
134134
<HeaderTitle><FormattedMessage id="header"/></HeaderTitle>
135135
<Media>

0 commit comments

Comments
 (0)