Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/Angelillo15/MetaCSR-Generator

This is a tool to generate an index.html file for each route to have a better SEO with placeholders.
https://github.com/Angelillo15/MetaCSR-Generator

client-side-rendering client-side-rendering-seo csr html-meta-tags node npm seo seo-optimization seo-tools vite vitejs webpack

Last synced: about 1 month ago
JSON representation

This is a tool to generate an index.html file for each route to have a better SEO with placeholders.

Awesome Lists containing this project

README

        

# MetaCSR Generator

This is a tool to generate an index.html file for each route to have a better SEO.

## Installation

### NPM

```bash
npm install -D metacsr-generator
```

### Yarn

```bash
yarn add -D metacsr-generator
```

## Usage (example for vite)

Create a metacsr.json file in the root of your project with the example configuration below.

```json
{
"project": "Minearte Web",
"baseHtmlPath": "./dist/index.html",
"distPath": "./dist/",
"routes": [{
"name": "Home",
"path": "/",
"description": "Home page",
"replaceMap": [{
"search": "{%title%}",
"replace": "Home Page"
}]
},
{
"name": "About",
"path": "/about",
"description": "About page",
"replaceMap": [{
"search": "{%title%}",
"replace": "About Page"
}]
}]
}
```
And in your html you can add the placeholders
```html





{%title%}




```

That will generate this structure
```bash
dist/
├── about
│   └── index.html
└── index.html
```

Here is an example in vite of a package.json

```json
{
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build && cp dist/index.html dist/404.html && metacsr -v --config metacsr.json",
"preview": "vite preview"
},
"meta-csr-generator": {
"routes": [
"/",
"/about",
"/contact"
]
}
}
```