@sphido/sitemap 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/readme.md +14 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphido/sitemap",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Roman Ožana",
|
|
6
6
|
"email": "roman@ozana.cz",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"test": "ava"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "d242c810431b4070f81198c5266f54b72927ee19"
|
|
25
25
|
}
|
package/readme.md
CHANGED
|
@@ -14,7 +14,7 @@ yarn add @sphido/sitemap
|
|
|
14
14
|
import {dirname, relative, join} from 'node:path';
|
|
15
15
|
import {getPages, allPages} from '@sphido/core';
|
|
16
16
|
import slugify from '@sindresorhus/slugify';
|
|
17
|
-
import {createSitemap
|
|
17
|
+
import {createSitemap} from '@sphido/sitemap';
|
|
18
18
|
import got from 'got';
|
|
19
19
|
|
|
20
20
|
const pages = await getPages({path: 'content'});
|
|
@@ -23,17 +23,20 @@ const map = await createSitemap('sitemap.xml');
|
|
|
23
23
|
map.add({url: 'https://sphido.org', priority: 1});
|
|
24
24
|
|
|
25
25
|
for (const page of await allPages(pages)) {
|
|
26
|
-
page.slug =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
page.slug = slugify(page.name) + '.html';
|
|
27
|
+
page.output = join('/', relative('content', dirname(page.path)), page.slug);
|
|
28
|
+
|
|
29
|
+
// prepare sitemap item properties
|
|
30
|
+
page.url = new URL(page.slug, 'https://sphido.org');
|
|
31
|
+
page.date = new Date();
|
|
32
|
+
page.priority = 0.5;
|
|
33
|
+
page.changefreq = 'daily';
|
|
34
|
+
|
|
35
|
+
// add page to sitemap
|
|
36
|
+
map.add(page);
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
map.end();
|
|
34
|
-
|
|
35
|
-
// ping Google about new sitemap
|
|
36
|
-
await got.get('https://www.google.com/webmasters/tools/ping?sitemap=https://sphido.org/sitemap.xml');
|
|
37
40
|
```
|
|
38
41
|
|
|
39
42
|
## Let them know
|
|
@@ -49,13 +52,12 @@ the first time that we notice it, and thereafter only when you ping us to let us
|
|
|
49
52
|
that it's changed. Alert Google about a sitemap only when it's new or updated;
|
|
50
53
|
don't submit or ping unchanged sitemaps multiple times.
|
|
51
54
|
|
|
52
|
-
You can use [got](https://github.com/sindresorhus/got)
|
|
55
|
+
You can use e.g. [got](https://github.com/sindresorhus/got) an HTTP request library for Node.js
|
|
53
56
|
or visit [URL manually](https://www.google.com/webmasters/tools/ping?sitemap=https://sphido.org/sitemap.xml)
|
|
54
57
|
|
|
55
58
|
```javascript
|
|
56
59
|
import got from 'got';
|
|
57
|
-
|
|
58
|
-
await got.get('https://www.google.com/webmasters/tools/ping?sitemap=https://sphido.org/sitemap.xml');
|
|
60
|
+
await got.get('https://www.google.com/webmasters/tools/ping?sitemap=URL');
|
|
59
61
|
```
|
|
60
62
|
|
|
61
63
|
### Bing, Seznam, Yandex
|