Skip to content

Commit

Permalink
Improve the sitemap generation
Browse files Browse the repository at this point in the history
  • Loading branch information
petrvecera committed Apr 9, 2024
1 parent 274d17c commit a67265c
Show file tree
Hide file tree
Showing 7 changed files with 675 additions and 639 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sitemap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ jobs:
run: |
gh auth setup-git
gh_pr_up() { gh pr create "$@" || gh pr edit "$@"; }
gh_pr_up --title "Update Sitemap" --body "Automatically generated sitemap update" --base master --head sitemap-update
gh_pr_up --title "Update Sitemap" --body "Automatically generated sitemap update" --base master --head sitemap-update --label "bot"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.


# unit paths generate fro the sitemap
unit-paths.txt

# dependencies
/node_modules
/.pnp
Expand Down Expand Up @@ -197,4 +201,4 @@ paths.txt
next.config.original.js


.yarn
.yarn
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ We have a special script for that.
2. Run

```
npx ts-node --compiler-options "{\"module\":\"commonjs\"}" scripts/unit-paths.ts > paths.txt
npx --yes ts-node --compiler-options "{\"module\":\"commonjs\"}" scripts/unit-paths.ts > unit-paths.txt
```

3. Copy the content of `paths.txt` and paste it into `next-sitemap.config.js`

### NextJS development

#### We would like to have most of the pages which require some data SSR ( Server Side Rendered).
Expand Down
595 changes: 302 additions & 293 deletions next-sitemap.config.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"fix:prettier": "prettier --log-level warn --write .",
"clean": "rm -fr .next && rm -fr node_modules",
"prepare": "husky",
"sitemap": "next-sitemap --config next-sitemap.config.js"
"sitemap": "npx --yes ts-node --compiler-options \"{\\\"module\\\":\\\"commonjs\\\"}\" scripts/unit-paths.ts > unit-paths.txt && next-sitemap --config next-sitemap.config.js"
},
"lint-staged": {
"*.{js,ts,jsx,tsx,yml}": [
Expand Down
700 changes: 362 additions & 338 deletions public/sitemap.xml

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions scripts/unit-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ const generateAllUnitPages = async () => {
return unitPaths;
}


generateAllUnitPages().then((paths) => {
console.dir(paths, { maxArrayLength: null });
for(const path of paths){
console.log(path)
}

})

Expand Down

0 comments on commit a67265c

Please sign in to comment.