Skip to content

Commit

Permalink
feat: webtools documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
boazpoolman committed Sep 15, 2024
1 parent 05ce6f5 commit 42e5fdf
Show file tree
Hide file tree
Showing 45 changed files with 928 additions and 66 deletions.
80 changes: 50 additions & 30 deletions docs/config-sync/getting-started/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@ Add the `config-sync` command as a script to the `package.json` of your Strapi p

You can now run all the `config-sync` commands like this:

```bash
# using yarn
yarn cs --help

# using npm
npm run cs --help
```
<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
```
yarn cs --help
```
</TabItem>
<TabItem value="npm" label="NPM">
```
npm run cs --help
```
</TabItem>
</Tabs>

## ⬆️ Import ⬇️ Export

Expand All @@ -35,15 +40,20 @@ These commands are used to sync the config in your Strapi project.

_Example:_

```bash
# using yarn
yarn cs import
yarn cs export

# using npm
npm run cs import
npm run cs export
```
<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
```
yarn cs import
yarn cs export
```
</TabItem>
<TabItem value="npm" label="NPM">
```
npm run cs import
npm run cs export
```
</TabItem>
</Tabs>

### Flag: `-y`, `--yes`

Expand Down Expand Up @@ -85,24 +95,34 @@ This command is used to see the difference between the config as found in the sy

_Example:_

```bash
# using yarn
yarn cs diff

# using npm
npm run cs diff
```
<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
```
yarn cs diff
```
</TabItem>
<TabItem value="npm" label="NPM">
```
npm run cs diff
```
</TabItem>
</Tabs>

### Argument: `<single>`

Add a single config name as the argument of the `diff` command to see the difference of that single file in a git-style diff viewer.

_Example:_

```bash
# using yarn
yarn cs diff user-role.public

# using npm
npm run cs diff user-role.public
```
<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
```
yarn cs diff user-role.public
```
</TabItem>
<TabItem value="npm" label="NPM">
```
npm run cs diff user-role.public
```
</TabItem>
</Tabs>
23 changes: 14 additions & 9 deletions docs/config-sync/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@ module.exports = ({ env }) => ({

After successful installation you have to rebuild the admin UI so it'll include this plugin. To rebuild and restart Strapi run:

```bash
# using yarn
yarn build
yarn develop

# using npm
npm run build
npm run develop
```
<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
```
yarn build
yarn develop
```
</TabItem>
<TabItem value="npm" label="NPM">
```
npm run build
npm run develop
```
</TabItem>
</Tabs>

The **Config Sync** plugin should now appear in the **Settings** section of your Strapi app.

Expand Down
8 changes: 0 additions & 8 deletions docs/webtools/_category_.json

This file was deleted.

15 changes: 15 additions & 0 deletions docs/webtools/addons/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
sidebar_label: 'Introduction'
displayed_sidebar: webtoolsSidebar
slug: /webtools/addons
---

# Webtools addons

Webtools is all about tools to enhance your website management workflow in Strapi. At it's core, it will keep a register of all the URLs on your website, using those to uniquely identify the different pages. This is a functionality that can easily be built upon by other plugins who also expect Strapi to have a register of URLs. Think of a sitemap, a menu, dynamic links, redirects etc.

To enhance Webtools in a modular way, the core plugin allows addons to be registered to build upon it's functionalities. Addons are in Strapi terms just standalone plugins, but have `@pluginpal/webtools-core` as a peer dependency. You will have to install each addon as you would normally install a plugin in to Strapi.

<CustomDocCardsWrapper>
<CustomDocCard emoji="🔀" title="Sitemap" description="The Sitemap addon can be used to generate a customizable sitemap using all your Webtools URL aliases" link="/webtools/addons/sitemap" />
</CustomDocCardsWrapper>
7 changes: 7 additions & 0 deletions docs/webtools/addons/sitemap/api/rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_label: 'Rest API'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/api
---

# Rest API
17 changes: 17 additions & 0 deletions docs/webtools/addons/sitemap/configuration/auto-generate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
sidebar_label: 'Auto generate'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/configuration/auto-generate
---

# Auto generate

Alternatively to using cron to regenerate your sitemap, this plugin offers an automatic generation feature that will generate the sitemap through lifecycle methods. On `create`, `update` and `delete` this plugin will do a full sitemap regeneration. This way your sitemap will always be up-to-date when making content changes.

If you have a large sitemap the regeneration becomes an expensive task. Because of that this setting is disabled by default and it is not recommended to enable it for sitemaps with more than 1000 links.

Also the search engines don't even crawl your sitemap that often, so generating it once a day through cron should be suffecient.

###### Key: `autoGenerate `

> `required:` NO | `type:` bool | `default:` false
15 changes: 15 additions & 0 deletions docs/webtools/addons/sitemap/configuration/cron.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
sidebar_label: 'Cron'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/configuration/cron
---

# CRON

To make sure the sitemap stays up-to-date this plugin will automatically schedule a cron job that generates the sitemap for you. That cron job is configured to run once a day at 00:00.

If you want to change the cron interval you can alter the `cron` setting.

###### Key: `cron `

> `required:` NO | `type:` bool | `default:` 0 0 0 * * *
7 changes: 7 additions & 0 deletions docs/webtools/addons/sitemap/configuration/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
sidebar_label: 'Introduction'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/configuration
---

# Configuration
15 changes: 15 additions & 0 deletions docs/webtools/addons/sitemap/configuration/limit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
sidebar_label: 'Limit'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/configuration/limit
---

# Limit

When creating large sitemaps (50.000+ URLs) you might want to split the sitemap in to chunks that you bring together in a sitemap index.

The limit is there to specify the maximum amount of URL a single sitemap may hold. If you try to add more URLs to a single sitemap.xml it will automatically be split up in to chunks which are brought together in a single sitemap index.

###### Key: `limit `

> `required:` NO | `type:` int | `default:` 45000
17 changes: 17 additions & 0 deletions docs/webtools/addons/sitemap/configuration/xsl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
sidebar_label: 'XSL'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/xsl
---

# XSL

This plugin ships with some XSL files to make your sitemaps human readable. It adds some styling and does some reordering of the links.

These changes are by no means a requirement for your sitemap to be valid. It is really just there to make your sitemap look pretty.

If you have a large sitemap you might encounter performance issues when accessing the sitemap.xml from the browser. In that case you can disable the XSL to fix these issues.

###### Key: `xsl `

> `required:` NO | `type:` bool | `default:` true
32 changes: 32 additions & 0 deletions docs/webtools/addons/sitemap/getting-started/cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
sidebar_label: 'CLI'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/cli
---

# 📺 CLI

This plugin comes with it's own `strapi-sitemap` CLI.
You can add it to your project like so:

```
"scripts": {
// ...
"sitemap": "strapi-sitemap"
},
```

You can now run the `generate` command like so:

<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
```
yarn sitemap generate
```
</TabItem>
<TabItem value="npm" label="NPM">
```
npm run sitemap generate
```
</TabItem>
</Tabs>
52 changes: 52 additions & 0 deletions docs/webtools/addons/sitemap/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
sidebar_label: 'Installation'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/installation
---

# ⏳ Installation

:::prerequisites
Complete installation requirements are the exact same as for Strapi itself and can be found in the Strapi documentation.

**Supported Strapi versions:**

Strapi v5 use `@pluginpal/webtools-addon-sitemap@^1`

Strapi v4 use `@pluginpal/webtools-addon-sitemap@^1.0.0-beta`

:::

Install the plugin in your Strapi project.

<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
```
yarn add @pluginpal/webtools-addon-sitemap
```
</TabItem>
<TabItem value="npm" label="NPM">
```
npm install @pluginpal/webtools-addon-sitemap --save
```
</TabItem>
</Tabs>

After successful installation you have to rebuild the admin UI so it'll include this plugin. To rebuild and restart Strapi run:

<Tabs groupId="yarn-npm">
<TabItem value="yarn" label="Yarn">
```
yarn build
yarn develop
```
</TabItem>
<TabItem value="npm" label="NPM">
```
npm run build
npm run develop
```
</TabItem>
</Tabs>

Enjoy 🎉
23 changes: 23 additions & 0 deletions docs/webtools/addons/sitemap/getting-started/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
sidebar_label: 'Introduction'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap
---

# Webtools Sitemap addon

:::info
This Webtools addon was originally a standalone plugin published to NPM as `strapi-plugin-sitemap`. To read the old docs, please refer to the standalone plugin [github repo](https://github.com/pluginpal/strapi-plugin-sitemap).
:::

## ✨ Features

- **Multilingual** (Implements `rel="alternate"` with `@strapi/plugin-i18n`)
- **URL bundles** (Bundle URLs by type and add them to the sitemap XML)
- **Virtual sitemap** (Sitemaps served from the database)
- **Cron regeneration** (Automatically scheduled cron job for regeneration)
- **Sitemap indexes** (Paginated sitemap indexes for large URL sets)
- **Exclude URLs** (Exclude specified URLs from the sitemap)
- **Custom URLs** (URLs of pages which are not managed in Strapi)
- **CLI** (CLI for sitemap generation)
- **Styled with XSL** (Human readable XML styling)
15 changes: 15 additions & 0 deletions docs/webtools/addons/sitemap/getting-started/multilingual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
sidebar_label: 'Multilingual'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/multilingual
---

# 🌍 Multilingual

When adding a URL bundle of a type which has localizations enabled you will be presented with a language dropdown in the settings form. You can now set a different URL pattern for each language.

For each localization of a page the `<url>` in the sitemap XML will get an extra attribute:

- `<xhtml:link rel="alternate">`

This implementation is based on [Google's guidelines](https://developers.google.com/search/docs/advanced/crawling/localized-versions) on localized sitemaps.
15 changes: 15 additions & 0 deletions docs/webtools/addons/sitemap/getting-started/robots-txt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
sidebar_label: 'Robots.txt'
displayed_sidebar: webtoolsSitemapSidebar
slug: /webtools/addons/sitemap/robots-txt
---

# 🤖 Robots.txt

To make sure search engines are able to find the sitemap XML create a `robots.txt` file in the front-end of your website and add the following line:

```
Sitemap: https://your-strapi-domain.com/api/sitemap/index.xml
```

Read more about the `robots.txt` file [here](https://developers.google.com/search/docs/advanced/robots/create-robots-txt).
Loading

0 comments on commit 42e5fdf

Please sign in to comment.