File tree 5 files changed +62
-5
lines changed
5 files changed +62
-5
lines changed Original file line number Diff line number Diff line change 38
38
- name : Install dependencies
39
39
run : npm ci
40
40
- name : Build
41
- run : npm run build && cp ./dist/index.html ./dist/404.html
41
+ run : npm run build && node .\generateRoutes.js
42
42
- name : Setup Pages
43
43
uses : actions/configure-pages@v4
44
44
- name : Upload artifact
Original file line number Diff line number Diff line change 5
5
6
6
## Notes
7
7
8
- - Always wrap a page (route) with Layout component
9
- - An internal link must be Link component from 'react-router-dom'
8
+ - Always wrap a page (route) with Layout component.
9
+ - If you create a new page, add its metadata to routes.json.
10
+ - An internal link must be Link component from 'react-router-dom'.
Original file line number Diff line number Diff line change
1
+ import routes from "./routes.json" assert { type : "json " } ;
2
+ import path from "path" ;
3
+ import fs from "fs" ;
4
+
5
+ const indexPage = fs . readFileSync ( "./dist/index.html" , "utf-8" ) ;
6
+ for ( const route of routes ) {
7
+ const routePage = indexPage
8
+ . replace ( / < t i t l e > .+ < \/ t i t l e > / , `<title>${ route . title } </title>` )
9
+ . replace (
10
+ / ( < m e t a .+ d e s c r i p t i o n .+ c o n t e n t = " ) .+ ( " \s * \/ > ) / g,
11
+ `$1${ route . description } $2`
12
+ ) ;
13
+ const filePath = path . join ( "./dist" , route . path + ".html" ) ;
14
+ const dir = path . dirname ( filePath ) ;
15
+ if ( ! fs . existsSync ( dir ) ) {
16
+ fs . mkdirSync ( dir , { recursive : true } ) ;
17
+ }
18
+ fs . writeFileSync ( filePath , routePage , "utf-8" ) ;
19
+ }
Original file line number Diff line number Diff line change 4
4
< meta charset ="UTF-8 " />
5
5
< link rel ="icon " type ="image/png " href ="/ico.png " />
6
6
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7
- < title > LNReader</ title >
8
- < meta name ="description " content ="Discover and read light novels, novels and more - easier than ever on your Android device. ">
7
+ < title > Home | LNReader</ title >
8
+ < meta name ="description " content ="Discover and read light novels, novels and more - easier than ever on your Android device. "/ >
9
9
< meta property ="og:title " content ="LNReader "/>
10
10
< meta property ="og:image " content ="https://lnreader.github.io/ico.png " />
11
11
< meta property ="og:description " content ="Discover and read light novels, novels and more - easier than ever on your Android device. " />
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "path" : " download" ,
4
+ "title" : " Download | LNReader" ,
5
+ "description" : " Download page that allows users to access and install the latest version of the app."
6
+ },
7
+ {
8
+ "path" : " changelogs" ,
9
+ "title" : " Changelos | LNReader" ,
10
+ "description" : " Changelogs of all LNReader stable releases."
11
+ },
12
+ {
13
+ "path" : " contribute" ,
14
+ "title" : " Contribute | LNReader" ,
15
+ "description" : " Find out how to help build the app."
16
+ },
17
+ {
18
+ "path" : " plugins" ,
19
+ "title" : " Plugins | LNReader" ,
20
+ "description" : " Browse and download sources for LNReader."
21
+ },
22
+ {
23
+ "path" : " guides/getting-started" ,
24
+ "title" : " Getting started | LNReader" ,
25
+ "description" : " Essential information to help you get set up with LNReader."
26
+ },
27
+ {
28
+ "path" : " guides/backups" ,
29
+ "title" : " Backups | LNReader" ,
30
+ "description" : " Backup your novels in remote ways"
31
+ },
32
+ {
33
+ "path" : " guides/reader-settings" ,
34
+ "title" : " Reader settings | LNReader" ,
35
+ "description" : " This section relates to the reading experience in the app and navigating the reader."
36
+ }
37
+ ]
You can’t perform that action at this time.
0 commit comments