From 849b4f6447894f19df77016d5c2af56b829f8885 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sun, 14 Apr 2024 18:19:14 +0200 Subject: [PATCH] update tsconfig --- npmextra.json | 19 +++++-- package.json | 17 ++++++- readme.hints.md | 1 + readme.md | 133 ++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 139 insertions(+), 31 deletions(-) create mode 100644 readme.hints.md diff --git a/npmextra.json b/npmextra.json index 1554725..93d8ea1 100644 --- a/npmextra.json +++ b/npmextra.json @@ -5,17 +5,30 @@ "githost": "code.foss.global", "gitscope": "push.rocks", "gitrepo": "smartsitemap", - "description": "a sitemap module", + "description": "A module for generating and managing sitemaps, supporting dynamic sitemap generation from feeds.", "npmPackagename": "@push.rocks/smartsitemap", "license": "MIT", - "projectDomain": "push.rocks" + "projectDomain": "push.rocks", + "keywords": [ + "sitemap generator", + "RSS feeds", + "news sitemap", + "XML sitemap", + "website indexing", + "search engine optimization", + "SEO", + "web crawling", + "dynamic sitemap creation", + "TypeScript", + "node.js" + ] } }, "npmci": { "npmGlobalTools": [], "npmAccessLevel": "public" }, - "tsdocs": { + "tsdoc": { "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" } } \ No newline at end of file diff --git a/package.json b/package.json index 3a22f2d..198bc8f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@push.rocks/smartsitemap", "version": "2.0.3", "private": false, - "description": "a sitemap module", + "description": "A module for generating and managing sitemaps, supporting dynamic sitemap generation from feeds.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "type": "module", @@ -44,5 +44,18 @@ "cli.js", "npmextra.json", "readme.md" + ], + "keywords": [ + "sitemap generator", + "RSS feeds", + "news sitemap", + "XML sitemap", + "website indexing", + "search engine optimization", + "SEO", + "web crawling", + "dynamic sitemap creation", + "TypeScript", + "node.js" ] -} +} \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index ad3a19d..037a025 100644 --- a/readme.md +++ b/readme.md @@ -1,37 +1,118 @@ # @push.rocks/smartsitemap -undefined variable +a sitemap module -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartsitemap) -* [gitlab.com (source)](https://gitlab.com/push.rocks/smartsitemap) -* [github.com (source mirror)](https://github.com/push.rocks/smartsitemap) -* [docs (typedoc)](https://push.rocks.gitlab.io/smartsitemap/) +## Install -## Status for master +To install `@push.rocks/smartsitemap`, use npm or yarn: -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartsitemap/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartsitemap/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartsitemap)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartsitemap)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartsitemap)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartsitemap)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartsitemap)](https://lossless.cloud) +```bash +npm install @push.rocks/smartsitemap --save +# or +yarn add @push.rocks/smartsitemap +``` + +This will add `@push.rocks/smartsitemap` to your project's dependencies. ## Usage -Use TypeScript for best in class intellisense +`@push.rocks/smartsitemap` provides a versatile way to create, manage, and parse sitemaps in TypeScript. Below are examples demonstrating how to utilize its capabilities in various scenarios. Please note that these examples are written using ESM syntax and TypeScript. -## Contribution +### Creating a News Sitemap from an RSS Feed -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +To generate a sitemap for news articles based on an RSS feed URL, you can use the `createSitemapNewsFromFeedUrl` method: -For further information read the linked docs at the top of this readme. +```typescript +import { SmartSitemap } from '@push.rocks/smartsitemap'; -## Legal -> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +async function generateNewsSitemap() { + const sitemapGenerator = new SmartSitemap(); + const sitemapXml = await sitemapGenerator.createSitemapNewsFromFeedUrl('https://yourwebsite.com/feed'); + console.log(sitemapXml); +} +generateNewsSitemap(); +``` + +This function fetches the RSS feed, parses the articles, and generates a sitemap XML string suitable for news content. + +### Parsing a Sitemap + +To parse an existing sitemap, employ the `parseSitemapUrl` method which accepts a sitemap URL and returns a parsed object: + +```typescript +import { SmartSitemap } from '@push.rocks/smartsitemap'; + +async function parseExistingSitemap() { + const sitemapParser = new SmartSitemap(); + const parsedSitemap = await sitemapParser.parseSitemapUrl('https://yourwebsite.com/sitemap.xml'); + console.log(parsedSitemap); +} +parseExistingSitemap(); +``` + +### Creating a Website Sitemap from a YAML String + +Generating a regular website sitemap from a YAML string, which lists URLs and their update frequencies, is straightforward with `createSitemapFromYmlString`: + +```typescript +import { SmartSitemap } from '@push.rocks/smartsitemap'; + +const yamlString = ` +daily: + - https://yourwebsite.com/ + - https://yourwebsite.com/about +`; + +async function generateWebsiteSitemap() { + const sitemapGenerator = new SmartSitemap(); + const sitemapXml = await sitemapGenerator.createSitemapFromYmlString(yamlString); + console.log(sitemapXml); +} +generateWebsiteSitemap(); +``` + +### Creating a Website Sitemap from a URL Array + +For more control, you can create a sitemap by providing an array of URL objects using `createSitemapFromUrlInfoArray`: + +```typescript +import { SmartSitemap, IUrlInfo } from '@push.rocks/smartsitemap'; + +const urlInfos: IUrlInfo[] = [ + { url: 'https://yourwebsite.com/', timestamp: Date.now(), frequency: 'daily' }, + { url: 'https://yourwebsite.com/about', timestamp: Date.now(), frequency: 'weekly' } +]; + +async function generateWebsiteSitemap() { + const sitemapGenerator = new SmartSitemap(); + const sitemapXml = await sitemapGenerator.createSitemapFromUrlInfoArray(urlInfos); + console.log(sitemapXml); +} +generateWebsiteSitemap(); +``` + +### Advanced Usage: Combining News and Website Sitemaps + +For comprehensive sitemap management, including both regular webpage URLs and news articles, you can combine the methods shown above to fit your specific needs. + +This module offers flexibility and ease of use for generating sitemaps compatible with search engines like Google, enhancing SEO by ensuring your site's content is fully indexed. + +Always refer to the latest documentation and class references to utilize all features provided by `@push.rocks/smartsitemap`, as this guide focuses on fundamental usages and may not cover more advanced or newly introduced functionalities. + +## License and Legal Information + +This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. + +**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file. + +### Trademarks + +This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH. + +### Company Information + +Task Venture Capital GmbH +Registered at District court Bremen HRB 35230 HB, Germany + +For any legal inquiries or if you require further information, please contact us via email at hello@task.vc. + +By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.