Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
5fee3c6f
Unverified
Commit
5fee3c6f
authored
Oct 11, 2023
by
eddie
Committed by
GitHub
Oct 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: sitemap format (#7453)
parent
40b1e407
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1429 additions
and
367 deletions
+1429
-367
sitemap.xml
public/sitemap.xml
+1422
-358
generate-sitemap.js
scripts/generate-sitemap.js
+6
-8
routes.test.ts
src/pages/routes.test.ts
+1
-1
No files found.
public/sitemap.xml
View file @
5fee3c6f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
scripts/generate-sitemap.js
View file @
5fee3c6f
...
...
@@ -21,11 +21,11 @@ fs.readFile('./public/sitemap.xml', 'utf8', async (err, data) => {
const
sitemap
=
await
parseStringPromise
(
data
)
if
(
sitemap
.
urlset
.
url
)
{
sitemap
.
urlset
.
url
.
forEach
((
url
)
=>
{
const
lastMod
=
new
Date
(
url
[
'
$
'
]
.
lastmod
).
getTime
()
const
lastMod
=
new
Date
(
url
.
lastmod
).
getTime
()
if
(
lastMod
<
Date
.
now
()
-
weekMs
)
{
url
[
'
$
'
]
.
lastmod
=
nowISO
url
.
lastmod
=
nowISO
}
sitemapURLs
[
url
[
'
$
'
][
'
loc
'
]
]
=
true
sitemapURLs
[
url
.
loc
]
=
true
})
}
...
...
@@ -45,11 +45,9 @@ fs.readFile('./public/sitemap.xml', 'utf8', async (err, data) => {
const
tokenURL
=
`https://app.uniswap.org/tokens/
${
chainName
.
toLowerCase
()}
/
${
address
}
`
if
(
!
(
tokenURL
in
sitemapURLs
))
{
sitemap
.
urlset
.
url
.
push
({
$
:
{
loc
:
[
tokenURL
],
lastmod
:
[
nowISO
],
priority
:
[
0.8
],
},
loc
:
[
tokenURL
],
lastmod
:
[
nowISO
],
priority
:
[
0.8
],
})
}
})
...
...
src/pages/routes.test.ts
View file @
5fee3c6f
...
...
@@ -9,7 +9,7 @@ describe('Routes', () => {
const
contents
=
fs
.
readFileSync
(
'
./public/sitemap.xml
'
,
'
utf8
'
)
const
sitemap
=
await
parseStringPromise
(
contents
)
const
sitemapPaths
:
string
[]
=
sitemap
.
urlset
.
url
.
map
((
url
:
any
)
=>
new
URL
(
url
[
'
$
'
]
.
loc
).
pathname
)
const
sitemapPaths
:
string
[]
=
sitemap
.
urlset
.
url
.
map
((
url
:
any
)
=>
new
URL
(
url
.
loc
).
pathname
)
sitemapPaths
.
filter
((
p
)
=>
!
p
.
includes
(
'
/0x
'
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment