Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
svelte-sitemap
Advanced tools
Small helper which scans your Svelte routes folder and generates static sitemap.xml
sitemap.xml
generatorSmall helper which scans your Svelte routes and generates sitemap.xml
- Designed for SvelteKit
adapter-static
withprerender
option (SSG)- TypeScript, JavaScript, CLI version
- Useful options for customizing your sitemap
- Support for submiting sitemap to Google Search Console
- Support for Google sitemap index. Useful for large sites (more than 50K pages)
- Also compatible with Vercel hosting
- Workaround for this official SvelteKit issue
npm install svelte-sitemap --save-dev
# yarn add svelte-sitemap --dev
Use this library as a
postbuild
hook in yourpackage.json
file.
File: package.json
{
"name": "my-awesome-project",
"scripts": {
"postbuild": "npx svelte-sitemap --domain https://myawesomedomain.com"
}
}
It scans your routes in build/
folder and generates build/sitemap.xml
file.
Sometimes it can be useful to call the script directly from JavaScript or TypeScript. Of course there is also this option, but in most cases you will need the CLI method as a postbuild hook.
File my-script.js
:
import { createSitemap } from 'svelte-sitemap/src/index.js';
createSitemap('https://example.com', { debug: true });
And now you can run your script like this: node my-script.js
Option | Description | Default | Example |
---|---|---|---|
--domain , -d | Use your domain [required] | - | -d https://mydomain.com |
--out-dir , -o | Set custom build folder | build | -o dist |
--ignore , -i | Ignore files or folders | [] | -i '**/admin/**' -i 'my-secret-page' |
--trailing-slashes , -t | Add trailing slashes | false | --trailing-slashes |
--reset-time , -r | Set lastModified time to now | false | -r |
--change-freq , -c | Set change frequency Option | - | --change-freq daily |
--help , -h | Display this usage info | - | -v |
--version , -v | Show version | - | -h |
--debug | Show some useful logs | - | --debug |
Let's say we want to ignore all
admin
folders and subfolders + just one exact pagepages/my-secret-page
npx svelte-sitemap --domain https://www.example.com --ignore 'pages/my-secret-page' --ignore '**/admin/**'
Every time I deploy a new version, I want to inform Google that there is a new update.
See this discussion with very useful tips.
× Folder 'build/' doesn't exist. Make sure you are using this library as 'postbuild' so 'build/' folder was successfully created before running this script.
build
, you can use the outDir
(--out-dir)
option.adapter-vercel
you'll probably want to use it like this:npx svelte-sitemap --out-dir .vercel/output/static --domain https://www.example.com
Or check out other solutions and join the discussion.
× There is no static html file in your 'build/' folder. Are you sure you are using Svelte adapter-static with prerender option?
This library is intended for the static adapter and prerender
option (SSG). So if there are no static files, then my library will not work for you :/
Give a ⭐️ if this project helped you!
Or if you are brave enough consider making a donation for some 🍺 or 🍵 ;)
I DO NOT STORE ANY DATA. PERIOD.
I physically can't. I have nowhere to store it. I don't even have a server database to store it. So even if Justin Bieber asked nicely to see your data, I wouldn't have anything to show him.
That's why, with this library, what happens on your device stays on your device till disappear.
I welcome you to customize this according to your needs ;)
Pull requests for any improvements would be great!
Feel free to check issues page.
git clone git@github.com:bartholomej/svelte-sitemap.git
cd svelte-sitemap
yarn
yarn start
You can find and modify it in ./demo.ts
file
yarn demo
Copyright © 2023 Lukas Bartak
Proudly powered by nature 🗻, wind 💨, tea 🍵 and beer 🍺 ;)
All contents are licensed under the MIT license.
FAQs
Small helper which scans your Svelte routes folder and generates static sitemap.xml
The npm package svelte-sitemap receives a total of 2,031 weekly downloads. As such, svelte-sitemap popularity was classified as popular.
We found that svelte-sitemap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.