Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xstevenyung/fresh-seo

The fastest way ⚡️ to create sitemap and robots.txt in your Deno Fresh project 🍋
https://github.com/xstevenyung/fresh-seo

deno fresh seo sitemap typescript

Last synced: 15 days ago
JSON representation

The fastest way ⚡️ to create sitemap and robots.txt in your Deno Fresh project 🍋

Awesome Lists containing this project

README

        

# Fresh SEO 🍋   [![Badge License]][License]

*Quickly creating sitemaps for your **Deno [Fresh project]**.*


## Getting Started

*Import the plugin `freshSEOPlugin` in your Fresh app*

```ts
// ./main.ts
import { start } from "$fresh/server.ts";
import manifest from "./fresh.gen.ts";

import { freshSEOPlugin } from "https://deno.land/x/fresh_seo/mod.ts";

await start(manifest, {
plugins: [
freshSEOPlugin(manifest)
],
});

```

A basic sitemap should now be available at:

[`http://localhost:8000/sitemap.xml`][Localhost]


## How does it work?

**Fresh SEO 🍋** automatically maps out **static** routes in your project.

*For basic routes, you do not have to do anything manually.*


### Dynamic Routes

*You will still have to map dynamic routes yourself!*

```ts
// ./main.ts
import { start } from "$fresh/server.ts";
import manifest from "./fresh.gen.ts";

import { freshSEOPlugin } from "https://deno.land/x/fresh_seo/mod.ts";

await start(manifest, {
plugins: [
freshSEOPlugin(manifest, {
include: ["/blog/intro"]
})
],
});
```

*You can also remove unwanted routes*

```ts
// ./main.ts
import { start } from "$fresh/server.ts";
import manifest from "./fresh.gen.ts";

import { freshSEOPlugin } from "https://deno.land/x/fresh_seo/mod.ts";

await start(manifest, {
plugins: [
freshSEOPlugin(manifest, {
exclude: [
"/blog/intro",
"/api/*"
]
})
],
});
```


## Testing

The test suite can be started with

```shell
deno task test
```


[Fresh project]: https://fresh.deno.dev/
[Localhost]: http://localhost:8000/sitemap.xml

[License]: LICENSE

[Badge License]: https://img.shields.io/badge/License-MIT-ac8b11.svg?style=for-the-badge&labelColor=yellow