diff --git a/.changeset/bumpy-islands-bet.md b/.changeset/bumpy-islands-bet.md new file mode 100644 index 00000000..3eb0fb9d --- /dev/null +++ b/.changeset/bumpy-islands-bet.md @@ -0,0 +1,5 @@ +--- +"docs": patch +--- + +Fix the broken images on the docs diff --git a/.changeset/dry-clouds-run.md b/.changeset/dry-clouds-run.md new file mode 100644 index 00000000..7ef38ce1 --- /dev/null +++ b/.changeset/dry-clouds-run.md @@ -0,0 +1,5 @@ +--- +"webtools-addon-sitemap": patch +--- + +Make sure the strapi-sitemap CLI is actually published to the /bin diff --git a/.changeset/great-worlds-own.md b/.changeset/great-worlds-own.md new file mode 100644 index 00000000..524e4c65 --- /dev/null +++ b/.changeset/great-worlds-own.md @@ -0,0 +1,5 @@ +--- +"docs": patch +--- + +Update response structures for Strapi v5 diff --git a/.changeset/rare-cups-repeat.md b/.changeset/rare-cups-repeat.md new file mode 100644 index 00000000..acd14057 --- /dev/null +++ b/.changeset/rare-cups-repeat.md @@ -0,0 +1,5 @@ +--- +"docs": patch +--- + +Add documentation for the slugify config diff --git a/.changeset/ripe-crabs-roll.md b/.changeset/ripe-crabs-roll.md new file mode 100644 index 00000000..5117ec11 --- /dev/null +++ b/.changeset/ripe-crabs-roll.md @@ -0,0 +1,5 @@ +--- +"strapi-plugin-webtools": minor +--- + +New config 'slugify' to overwrite the slugify function of the plugin diff --git a/package.json b/package.json index ddfcf20d..01568862 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "playground:build": "cd playground && yarn build", "playground:start": "cd playground && yarn start", "playground:develop": "rm -rf playground/node_modules/.strapi/ && cd playground && yarn develop --watch-admin --bundler=vite", + "docs:start": "cd packages/docs/ && yarn start", + "docs:build": "cd packages/docs/ && yarn build", "test:e2e": "cypress open", "test:unit": "ENV_PATH=./playground/.env jest --verbose --runInBand --forceExit", "test:integration": "ENV_PATH=./playground/.env jest --verbose --runInBand --forceExit --testMatch '**/healthcheck.test.js'" diff --git a/packages/addons/sitemap/bin/config-sync b/packages/addons/sitemap/bin/strapi-sitemap similarity index 100% rename from packages/addons/sitemap/bin/config-sync rename to packages/addons/sitemap/bin/strapi-sitemap diff --git a/packages/addons/sitemap/package.json b/packages/addons/sitemap/package.json index 8eeeb89f..0bb6bf76 100644 --- a/packages/addons/sitemap/package.json +++ b/packages/addons/sitemap/package.json @@ -15,8 +15,7 @@ "files": [ "dist", "xsl", - "strapi-admin.js", - "strapi-server.js" + "bin" ], "bin": { "strapi-sitemap": "./bin/strapi-sitemap" diff --git a/packages/docs/docs/api/rest.md b/packages/docs/docs/api/rest.md index f5cb0696..c4810ef9 100644 --- a/packages/docs/docs/api/rest.md +++ b/packages/docs/docs/api/rest.md @@ -33,19 +33,16 @@ Other than the path parameter this endpoint should behave just like a native fin { "data": { "id": 2, - "attributes": { - "title": "Robust Strapi plugins for your project", - "createdAt": "2023-11-28T21:06:51.727Z", - "updatedAt": "2024-08-10T09:19:43.568Z", - "publishedAt": "2023-12-10T12:54:15.699Z", - "locale": "en", - "body": "Try our open source plugins to enhance your Strapi project for free! For custom solutions please contact our team.", - "contentType": "api::home.home" - } + "documentId": "ke1s1aroaexv8jt03iuxn81g", + "title": "Robust Strapi plugins for your project", + "createdAt": "2025-03-09T16:45:24.886Z", + "updatedAt": "2025-03-13T20:38:43.112Z", + "publishedAt": "2025-03-13T17:06:57.578Z", + "locale": "en", + "body": "Try our open source plugins to enhance your Strapi project for free! For custom solutions please contact our team.", + "contentType": "api::home.home" }, - "meta": { - - } + "meta": {} } ``` @@ -76,58 +73,53 @@ As it's a native findMany endpoint you can use all the parameters you're used to "data": [ { "id": 10, - "attributes": { - "url_path": "/articles", - "generated": true, - "contenttype": "api::page.page", - "createdAt": "2024-08-10T09:19:43.348Z", - "updatedAt": "2024-08-10T09:19:44.581Z", - "locale": "en" - } + "documentId": "ke1s1aroaexv8jt03iuxn81g", + "url_path": "/articles", + "generated": true, + "contenttype": "api::page.page", + "createdAt": "2025-03-09T16:45:24.886Z", + "updatedAt": "2025-03-13T20:38:43.112Z", + "locale": "en" }, { "id": 14, - "attributes": { - "url_path": "/plugins", - "generated": true, - "contenttype": "api::page.page", - "createdAt": "2024-08-10T09:19:43.808Z", - "updatedAt": "2024-08-10T09:19:44.611Z", - "locale": "en" - } + "documentId": "f4x8aamrfaec0t5oea408n34", + "url_path": "/plugins", + "generated": true, + "contenttype": "api::page.page", + "createdAt": "2025-03-09T16:45:24.886Z", + "updatedAt": "2025-03-13T20:38:43.112Z", + "locale": "en" }, { "id": 18, - "attributes": { - "url_path": "/privacy-policy", - "generated": null, - "contenttype": "api::page.page", - "createdAt": "2024-09-01T12:55:04.863Z", - "updatedAt": "2024-09-01T12:55:29.346Z", - "locale": "en" - } + "documentId": "fdg21vh8i5bzbbwjm50dwk60", + "url_path": "/privacy-policy", + "generated": null, + "contenttype": "api::page.page", + "createdAt": "2025-03-09T16:45:24.886Z", + "updatedAt": "2025-03-13T20:38:43.112Z", + "locale": "en" }, { "id": 21, - "attributes": { - "url_path": "/terms-and-conditions", - "generated": null, - "contenttype": "api::page.page", - "createdAt": "2024-09-01T13:13:14.364Z", - "updatedAt": "2024-09-01T13:13:30.147Z", - "locale": "en" - } + "documentId": "so0mehxfna6l3o6i0aul75gr", + "url_path": "/terms-and-conditions", + "generated": null, + "contenttype": "api::page.page", + "createdAt": "2025-03-09T16:45:24.886Z", + "updatedAt": "2025-03-13T20:38:43.112Z", + "locale": "en" }, { "id": 11, - "attributes": { - "url_path": "/", - "generated": null, - "contenttype": "api::home.home", - "createdAt": "2024-08-10T09:19:43.351Z", - "updatedAt": "2024-09-01T13:44:57.434Z", - "locale": "en" - } + "documentId": "idrdcm7f9cn3w7iex32t2hh3", + "url_path": "/", + "generated": null, + "contenttype": "api::home.home", + "createdAt": "2025-03-09T16:45:24.886Z", + "updatedAt": "2025-03-13T20:38:43.112Z", + "locale": "en" }, ], "meta": { diff --git a/packages/docs/docs/configuration/default-pattern.md b/packages/docs/docs/configuration/default-pattern.md index d333f796..dba919b4 100644 --- a/packages/docs/docs/configuration/default-pattern.md +++ b/packages/docs/docs/configuration/default-pattern.md @@ -13,4 +13,4 @@ Webtools allows you to create custom URL patterns, specifically tweaked to your | Key | `default_pattern` | | Required | false | | Type | string | -| Default | `/[pluralName]/[id]` | +| Default | `/[pluralName]/[documentId]` | diff --git a/packages/docs/docs/configuration/introduction.md b/packages/docs/docs/configuration/introduction.md index ebc04fd7..42b94bff 100644 --- a/packages/docs/docs/configuration/introduction.md +++ b/packages/docs/docs/configuration/introduction.md @@ -9,13 +9,17 @@ The settings of the plugin can be overridden in the `config/plugins.js` file. In the example below you can see how, and also what the default settings are. ```md title="config/plugins.js" -module.exports = ({ env }) => ({ - // ... - 'webtools': { +import deburr from 'lodash/deburr'; +import toLower from 'lodash/toLower'; +import kebabCase from 'lodash/kebabCase'; + +export default ({ env }) => ({ + webtools: { enabled: true, config: { - default_pattern: "/[pluralName]/[id]", + default_pattern: "/[pluralName]/[documentId]", website_url: null, + slugify: (fieldValue) => kebabCase(deburr(toLower(fieldValue))), }, }, }); diff --git a/packages/docs/docs/configuration/slugify.md b/packages/docs/docs/configuration/slugify.md new file mode 100644 index 00000000..ca2f7023 --- /dev/null +++ b/packages/docs/docs/configuration/slugify.md @@ -0,0 +1,31 @@ +--- +sidebar_label: 'Slugify' +displayed_sidebar: webtoolsSidebar +slug: /configuration/slugify +--- + +# Slugify + +This config can be used to overwrite the function that is used to slugify your URLs. The function takes a single parameter which is the path before being slugified. It expects the return value to be the slugified URL. + +### Example: + +```md title="config/plugins.js" +import deburr from 'lodash/deburr'; +import toLower from 'lodash/toLower'; +import kebabCase from 'lodash/kebabCase'; + +export default ({ env }) => ({ + webtools: { + config: { + slugify: (fieldValue) => kebabCase(deburr(toLower(fieldValue))), + }, + }, +}); +``` + +| Name | Details | +| ---- | ------- | +| Key | `slugify` | +| Required | false | +| Type | function | diff --git a/packages/docs/docs/getting-started/url-alias.md b/packages/docs/docs/getting-started/url-alias.md index 0d25812f..daa01be1 100644 --- a/packages/docs/docs/getting-started/url-alias.md +++ b/packages/docs/docs/getting-started/url-alias.md @@ -9,4 +9,4 @@ At the core of the plugin is URL alias. It's the idea that every page of a given See below a screenshot of the URL alias popup that's used to set the unique path of your page. -URL alias +URL alias diff --git a/packages/docs/docs/getting-started/url-pattern.md b/packages/docs/docs/getting-started/url-pattern.md index 3ab877a7..689c2f15 100644 --- a/packages/docs/docs/getting-started/url-pattern.md +++ b/packages/docs/docs/getting-started/url-pattern.md @@ -17,10 +17,10 @@ Fields can be injected in the pattern by escaping them with `[]`. The following field types are allowed in a pattern: -- `id` +- `documentId` - `uid` - `string` See below a screenshot of the URL pattern creation form in Strapi. -URL pattern +URL pattern diff --git a/packages/docs/docs/getting-started/usage.md b/packages/docs/docs/getting-started/usage.md index a12175fb..90408430 100644 --- a/packages/docs/docs/getting-started/usage.md +++ b/packages/docs/docs/getting-started/usage.md @@ -9,4 +9,4 @@ This plugin is specifically designed for usage in Strapi managed websites. Hence See below a screenshot of how to enable webtools for a given collection type. -Enable webtools +Enable webtools diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts index b35b23db..a9c08b0d 100644 --- a/packages/docs/sidebars.ts +++ b/packages/docs/sidebars.ts @@ -58,6 +58,7 @@ const sidebars = { "configuration/introduction", "configuration/default-pattern", "configuration/website-url", + "configuration/slugify", ], }, // { diff --git a/packages/docs/src/components/Card/Card.jsx b/packages/docs/src/components/Card/Card.jsx index 966ae819..bbaab858 100644 --- a/packages/docs/src/components/Card/Card.jsx +++ b/packages/docs/src/components/Card/Card.jsx @@ -2,7 +2,7 @@ import React from 'react'; import clsx from 'clsx'; import Link from '@docusaurus/Link'; import styles from './card.module.scss'; -import IconArrow from '@site/static/img/assets/icons/arrow-right.svg'; +import IconArrow from '@site/static/webtools/img/assets/icons/arrow-right.svg'; export function CardTitle({ as, diff --git a/packages/docs/src/components/LinkWithArrow/LinkWithArrow.jsx b/packages/docs/src/components/LinkWithArrow/LinkWithArrow.jsx index a3b81913..df3c5085 100644 --- a/packages/docs/src/components/LinkWithArrow/LinkWithArrow.jsx +++ b/packages/docs/src/components/LinkWithArrow/LinkWithArrow.jsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import React from 'react'; import Link from '@docusaurus/Link'; -import IconArrow from '@site/static/img/assets/icons/arrow-right.svg'; +import IconArrow from '@site/static/webtools/img/assets/icons/arrow-right.svg'; import styles from './link-with-arrow.module.scss'; export function LinkWithArrow({ diff --git a/packages/docs/static/img/assets/webtools/admin-url-overview.png b/packages/docs/static/img/assets/admin-url-overview.png similarity index 100% rename from packages/docs/static/img/assets/webtools/admin-url-overview.png rename to packages/docs/static/img/assets/admin-url-overview.png diff --git a/packages/docs/static/img/assets/config-sync/admin-diff-viewer.png b/packages/docs/static/img/assets/config-sync/admin-diff-viewer.png deleted file mode 100644 index a94ba4f3..00000000 Binary files a/packages/docs/static/img/assets/config-sync/admin-diff-viewer.png and /dev/null differ diff --git a/packages/docs/static/img/assets/config-sync/logo.png b/packages/docs/static/img/assets/config-sync/logo.png deleted file mode 100644 index 3e55669c..00000000 Binary files a/packages/docs/static/img/assets/config-sync/logo.png and /dev/null differ diff --git a/packages/docs/static/img/assets/webtools/enable-webtools.png b/packages/docs/static/img/assets/enable-webtools.png similarity index 100% rename from packages/docs/static/img/assets/webtools/enable-webtools.png rename to packages/docs/static/img/assets/enable-webtools.png diff --git a/packages/docs/static/img/assets/webtools/logo.png b/packages/docs/static/img/assets/logo.png similarity index 100% rename from packages/docs/static/img/assets/webtools/logo.png rename to packages/docs/static/img/assets/logo.png diff --git a/packages/docs/static/img/assets/webtools/url-alias.png b/packages/docs/static/img/assets/url-alias.png similarity index 100% rename from packages/docs/static/img/assets/webtools/url-alias.png rename to packages/docs/static/img/assets/url-alias.png diff --git a/packages/docs/static/img/assets/webtools/url-pattern.png b/packages/docs/static/img/assets/url-pattern.png similarity index 100% rename from packages/docs/static/img/assets/webtools/url-pattern.png rename to packages/docs/static/img/assets/url-pattern.png