File tree Expand file tree Collapse file tree 2 files changed +47
-2
lines changed
Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 3232 - name : Build application demo version 💪
3333 run : |
3434 ng build --configuration=demo --localize
35- mv dist-demo/browser/en/* dist-demo/browser
36- rm -r dist-demo/browser/en
35+ # create an index.html file for the demo redirecting to the english version
36+ echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=/en/index.html"></head></html>' > dist-demo/browser/index.html
37+ # copy 404 error page
38+ cp src/404.demo.html dist-demo/browser/404.html
3739
3840 - name : Deploy demo application 🚀
3941
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+
4+ < head >
5+ < meta charset ="utf-8 " />
6+ < title > Argus</ title >
7+ < link rel ="icon " type ="image/x-icon " href ="assets/images/argus-eye-16.png ">
8+ < base href ="/ ">
9+
10+ < script >
11+ // Store the URL the user was trying to access when receiving the 404.
12+ sessionStorage . redirect = location . href ;
13+
14+ const pathParser = new RegExp ( '^(?/(?<language>[a-z]{2})/(?<path>.*)$' ) ;
15+ const matches = pathParser . exec ( window . location . pathname ) ;
16+ if ( matches ) {
17+ const newPath = [ matches . groups . language ] . join ( '/' ) ;
18+ if ( newPath !== location . pathname ) {
19+ // Immediately redirect to the base URL so we can use the SPA routing.
20+ console . log ( 'Redirect to ' + newPath ) ;
21+ location . pathname = newPath ;
22+ }
23+ else {
24+ console . log ( 'No need to redirect' ) ;
25+ }
26+ }
27+ else if ( location . pathname == "/" ) {
28+ location . pathname = "/en/" ;
29+ }
30+ else {
31+ console . error ( 'Path does not match' , location . pathname ) ;
32+ }
33+ </ script >
34+ </ head >
35+
36+ < body >
37+ <!-- IE required at least 512 bytes of data to show non-default 404. -->
38+
39+
40+
41+ </ body >
42+
43+ </ html >
You can’t perform that action at this time.
0 commit comments