@sphido/sitemap 2.0.5 → 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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/readme.md +15 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphido/sitemap",
3
- "version": "2.0.5",
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": "2ec312ef7e5bf2c7c34694f66d5463ae79a00cf6"
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, pingSitemap} from '@sphido/sitemap';
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 = join('/', relative('content', dirname(page.path)), slugify(page.name) + '.html');
27
- map.add({
28
- url: 'https://sphido.org' + page.slug,
29
- date: new Date(),
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,15 +52,14 @@ 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) - Human-friendly and powerful HTTP request library for Node.js
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
- 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');
58
61
  ```
59
62
 
60
-
61
63
  ### Bing, Seznam, Yandex
62
64
 
63
65
  [IndexNow](https://www.indexnow.org/) is an open-source protocol that allows website publishers to
@@ -75,4 +77,4 @@ https://search.seznam.cz/indexnow?url=[URL]&key=[YOUR KEY]
75
77
 
76
78
  ## Source codes
77
79
 
78
- https://github.com/sphido/sphido/tree/main/packages/sphido-sitemap
80
+ [@sphido/sitemap](https://github.com/sphido/sphido/tree/main/packages/sphido-sitemap)