Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create old slugs field #903

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-kiwis-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@frameless/pdc-dashboard": minor
---

Nieuwe functie: oude paginalinks worden automatisch opgeslagen. Bij een titelwijziging worden bezoekers via de oude link doorgestuurd naar de juiste pagina.
5 changes: 5 additions & 0 deletions .changeset/perfect-cheetahs-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@frameless/strapi-plugin-old-slugs": major
---

Maak een tool om oude paginalinks op te slaan, zodat bezoekers correct worden doorgestuurd als de titel van een pagina verandert.
5 changes: 5 additions & 0 deletions .changeset/small-shoes-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@frameless/pdc-frontend": minor
---

Nieuwe functie: oude paginalinks worden automatisch opgeslagen. Bij een titelwijziging worden bezoekers via de oude link doorgestuurd naar de juiste pagina ([GitHub Issue frameless/strapi#789](https://github.com/frameless/strapi/issues/789)).
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ module.exports = {
'./packages/strapi-plugin-env-label/tsconfig.server.json',
'./packages/strapi-plugin-language/tsconfig.json',
'./packages/strapi-plugin-language/tsconfig.server.json',
'./packages/strapi-plugin-old-slugs/tsconfig.json',
'./packages/strapi-plugin-old-slugs/tsconfig.server.json',
'./packages/strapi-plugin-old-slugs/tsconfig.test.json',
'./packages/strapi-plugin-open-forms-embed/tsconfig.json',
'./packages/strapi-plugin-open-forms-embed/tsconfig.server.json',
'./packages/strapi-plugin-uniform-product-name/tsconfig.json',
Expand Down
10 changes: 10 additions & 0 deletions apps/pdc-dashboard/config/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,14 @@ export default ({ env }) => ({
},
},
},
'old-slugs': {
enabled: true,
config: {
contentTypes: [
{
uid: 'api::product.product',
},
],
},
},
});
1 change: 1 addition & 0 deletions apps/pdc-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@frameless/strapi-plugin-uniform-product-name": "0.0.0-semantically-released",
"@frameless/strapi-plugin-uuid-field": "0.0.0-semantically-released",
"@frameless/strapi-tiptap-editor": "0.1.1",
"@frameless/strapi-plugin-old-slugs": "0.0.0",
"@strapi/plugin-graphql": "4.25.8",
"@strapi/plugin-i18n": "4.25.8",
"@strapi/plugin-users-permissions": "4.25.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@
},
"type": "customField",
"customField": "plugin::uuid-field.uuid-field"
},
"oldSlugs": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "json"
}
}
}
4 changes: 0 additions & 4 deletions apps/pdc-dashboard/src/api/product/controllers/product.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* product controller
*/

import { factories } from '@strapi/strapi';

export default factories.createCoreController('api::product.product');
9 changes: 0 additions & 9 deletions apps/pdc-dashboard/src/api/product/routes/product.js

This file was deleted.

3 changes: 3 additions & 0 deletions apps/pdc-dashboard/src/api/product/routes/product.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { factories } from '@strapi/strapi';

export default factories.createCoreRouter('api::product.product');
9 changes: 0 additions & 9 deletions apps/pdc-dashboard/src/api/product/services/product.js

This file was deleted.

3 changes: 3 additions & 0 deletions apps/pdc-dashboard/src/api/product/services/product.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { factories } from '@strapi/strapi';

export default factories.createCoreService('api::product.product');
5 changes: 5 additions & 0 deletions apps/pdc-frontend/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const documents = {
"\n query getAlphabeticallyProductsByLetterQuery($locale: I18NLocaleCode, $page: Int, $pageSize: Int, $startsWith: String) {\n products(locale: $locale, pagination:{ page: $page, pageSize: $pageSize }, filters: { title: { startsWith: $startsWith } }, sort: \"title\") {\n meta {\n pagination {\n total\n page\n pageSize\n pageCount\n }\n }\n data {\n attributes {\n slug\n title\n locale\n updatedAt\n metaTags {\n description\n }\n }\n }\n }\n }\n": types.GetAlphabeticallyProductsByLetterQueryDocument,
"\n query checkAlphabeticallyProductsAvailability($locale: I18NLocaleCode, $startsWith: String) {\n products(locale: $locale, filters: { title: { startsWith: $startsWith } }) {\n data {\n attributes {\n title\n }\n }\n }\n }\n": types.CheckAlphabeticallyProductsAvailabilityDocument,
"\n query getProductBySlug(\n $slug: String\n $locale: I18NLocaleCode\n $pageMode: PublicationState\n) {\n products(\n filters: { slug: { eq: $slug } }\n locale: $locale\n publicationState: $pageMode\n ) {\n data {\n id\n attributes {\n title\n slug\n metaTags {\n title\n description\n keymatch\n ogImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n content\n sections {\n ... on ComponentComponentsUtrechtImage {\n __typename\n imageData {\n data {\n attributes {\n name\n alternativeText\n caption\n width\n height\n formats\n url\n }\n }\n }\n }\n ... on ComponentComponentsUtrechtLogoButton {\n __typename\n appearance\n href\n label\n logo\n openFormsEmbed\n textContent\n }\n ... on ComponentComponentsUtrechtSpotlight {\n __typename\n content\n type\n logoButton {\n id\n label\n href\n textContent\n logo\n appearance\n __typename\n }\n }\n ... on ComponentComponentsUtrechtRichText {\n __typename\n content\n }\n ... on ComponentComponentsUtrechtMultiColumnsButton {\n __typename\n column {\n id\n title\n logoButton {\n __typename\n appearance\n href\n label\n logo\n openFormsEmbed\n textContent\n }\n }\n }\n ... on ComponentComponentsUtrechtLink {\n __typename\n href\n textContent\n icon\n language\n }\n ... on ComponentComponentsFaq {\n __typename\n pdc_faq {\n data {\n attributes {\n title\n faq (pagination: {start: 0, limit: -1}) {\n body\n headingLevel\n id\n label\n }\n }\n }\n }\n }\n ... on ComponentComponentsUtrechtAccordion {\n __typename\n item (pagination: {start: 0, limit: -1}) {\n body\n headingLevel\n id\n label\n }\n }\n }\n price {\n data {\n attributes {\n price( pagination: {start: 0, limit: -1} ) {\n currency\n id\n label\n uuid\n value\n }\n }\n }\n }\n localizations {\n data {\n attributes {\n locale\n slug\n }\n }\n }\n locale\n }\n }\n }\n}\n\n": types.GetProductBySlugDocument,
"\nquery getProductsOldSlugs($locale: I18NLocaleCode) {\n products(\n pagination: { start: 0, limit: -1 }\n filters: { oldSlugs: { ne: null } }\n locale: $locale\n ) {\n data {\n attributes {\n slug\n oldSlugs\n }\n }\n }\n}\n": types.GetProductsOldSlugsDocument,
"\n query getProductBySlugAndLocale($slug: String, $locale: I18NLocaleCode, $pageMode: PublicationState) {\n products(filters: { slug: { eq: $slug } }, locale: $locale, publicationState: $pageMode) {\n data {\n attributes {\n slug\n locale\n }\n }\n }\n }\n": types.GetProductBySlugAndLocaleDocument,
"\nquery getNotFoundPage($locale: I18NLocaleCode){\n notFoundPage(locale: $locale) {\n data {\n attributes {\n title\n body\n }\n }\n }\n}\n": types.GetNotFoundPageDocument,
"\nquery getTemplateData($locale: I18NLocaleCode, $pageMode: PublicationState) {\n pdcTemplate(publicationState: $pageMode, locale: $locale) {\n data {\n attributes {\n sections {\n ... on ComponentComponentsUtrechtNavigation {\n __typename\n navigationList {\n id\n textContent\n href\n }\n }\n ... on ComponentComponentsUtrechtFooter {\n __typename\n title\n list {\n id\n listItem {\n id\n title\n link {\n id\n textContent\n href\n }\n }\n }\n address\n socialMediaList {\n id\n link {\n id\n textContent\n href\n icon\n }\n }\n }\n }\n }\n }\n }\n}\n\n": types.GetTemplateDataDocument,
Expand Down Expand Up @@ -63,6 +64,10 @@ export function graphql(source: "\n query checkAlphabeticallyProductsAvailabili
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query getProductBySlug(\n $slug: String\n $locale: I18NLocaleCode\n $pageMode: PublicationState\n) {\n products(\n filters: { slug: { eq: $slug } }\n locale: $locale\n publicationState: $pageMode\n ) {\n data {\n id\n attributes {\n title\n slug\n metaTags {\n title\n description\n keymatch\n ogImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n content\n sections {\n ... on ComponentComponentsUtrechtImage {\n __typename\n imageData {\n data {\n attributes {\n name\n alternativeText\n caption\n width\n height\n formats\n url\n }\n }\n }\n }\n ... on ComponentComponentsUtrechtLogoButton {\n __typename\n appearance\n href\n label\n logo\n openFormsEmbed\n textContent\n }\n ... on ComponentComponentsUtrechtSpotlight {\n __typename\n content\n type\n logoButton {\n id\n label\n href\n textContent\n logo\n appearance\n __typename\n }\n }\n ... on ComponentComponentsUtrechtRichText {\n __typename\n content\n }\n ... on ComponentComponentsUtrechtMultiColumnsButton {\n __typename\n column {\n id\n title\n logoButton {\n __typename\n appearance\n href\n label\n logo\n openFormsEmbed\n textContent\n }\n }\n }\n ... on ComponentComponentsUtrechtLink {\n __typename\n href\n textContent\n icon\n language\n }\n ... on ComponentComponentsFaq {\n __typename\n pdc_faq {\n data {\n attributes {\n title\n faq (pagination: {start: 0, limit: -1}) {\n body\n headingLevel\n id\n label\n }\n }\n }\n }\n }\n ... on ComponentComponentsUtrechtAccordion {\n __typename\n item (pagination: {start: 0, limit: -1}) {\n body\n headingLevel\n id\n label\n }\n }\n }\n price {\n data {\n attributes {\n price( pagination: {start: 0, limit: -1} ) {\n currency\n id\n label\n uuid\n value\n }\n }\n }\n }\n localizations {\n data {\n attributes {\n locale\n slug\n }\n }\n }\n locale\n }\n }\n }\n}\n\n"): (typeof documents)["\n query getProductBySlug(\n $slug: String\n $locale: I18NLocaleCode\n $pageMode: PublicationState\n) {\n products(\n filters: { slug: { eq: $slug } }\n locale: $locale\n publicationState: $pageMode\n ) {\n data {\n id\n attributes {\n title\n slug\n metaTags {\n title\n description\n keymatch\n ogImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n content\n sections {\n ... on ComponentComponentsUtrechtImage {\n __typename\n imageData {\n data {\n attributes {\n name\n alternativeText\n caption\n width\n height\n formats\n url\n }\n }\n }\n }\n ... on ComponentComponentsUtrechtLogoButton {\n __typename\n appearance\n href\n label\n logo\n openFormsEmbed\n textContent\n }\n ... on ComponentComponentsUtrechtSpotlight {\n __typename\n content\n type\n logoButton {\n id\n label\n href\n textContent\n logo\n appearance\n __typename\n }\n }\n ... on ComponentComponentsUtrechtRichText {\n __typename\n content\n }\n ... on ComponentComponentsUtrechtMultiColumnsButton {\n __typename\n column {\n id\n title\n logoButton {\n __typename\n appearance\n href\n label\n logo\n openFormsEmbed\n textContent\n }\n }\n }\n ... on ComponentComponentsUtrechtLink {\n __typename\n href\n textContent\n icon\n language\n }\n ... on ComponentComponentsFaq {\n __typename\n pdc_faq {\n data {\n attributes {\n title\n faq (pagination: {start: 0, limit: -1}) {\n body\n headingLevel\n id\n label\n }\n }\n }\n }\n }\n ... on ComponentComponentsUtrechtAccordion {\n __typename\n item (pagination: {start: 0, limit: -1}) {\n body\n headingLevel\n id\n label\n }\n }\n }\n price {\n data {\n attributes {\n price( pagination: {start: 0, limit: -1} ) {\n currency\n id\n label\n uuid\n value\n }\n }\n }\n }\n localizations {\n data {\n attributes {\n locale\n slug\n }\n }\n }\n locale\n }\n }\n }\n}\n\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\nquery getProductsOldSlugs($locale: I18NLocaleCode) {\n products(\n pagination: { start: 0, limit: -1 }\n filters: { oldSlugs: { ne: null } }\n locale: $locale\n ) {\n data {\n attributes {\n slug\n oldSlugs\n }\n }\n }\n}\n"): (typeof documents)["\nquery getProductsOldSlugs($locale: I18NLocaleCode) {\n products(\n pagination: { start: 0, limit: -1 }\n filters: { oldSlugs: { ne: null } }\n locale: $locale\n ) {\n data {\n attributes {\n slug\n oldSlugs\n }\n }\n }\n}\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading
Loading