Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add SEO to collection

dominik-zeglen29dd87be03e7
diff --git a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
index 2a3b7b7d1a..b66aec1c30 100644
--- a/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
+++ b/saleor/static/dashboard-next/collections/components/CollectionDetailsPage/CollectionDetailsPage.tsx
@@ -11,6 +11,8 @@ import { CollectionDetails_collection } from "../../types/CollectionDetails";
import CollectionDetails from "../CollectionDetails/CollectionDetails";
import CollectionProducts from "../CollectionProducts/CollectionProducts";
import { CollectionImage } from "../CollectionImage/CollectionImage";
+import SeoForm from "../../../components/SeoForm";
+import i18n from "../../../i18n";
export interface CollectionDetailsPageFormData {
name: string;
@@ -79,6 +81,21 @@ const CollectionDetailsPage = decorate<CollectionDetailsPageProps>(
collection={collection}
{...pageListProps}
/>
+ <CardSpacer />
+ <SeoForm
+ description={data.seoDescription}
+ disabled={disabled}
+ descriptionPlaceholder=""
+ helperText={i18n.t(
+ "Add search engine title and description to make this collection easier to find",
+ {
+ context: "help text"
+ }
+ )}
+ title={data.seoTitle}
+ titlePlaceholder={maybe(() => collection.name)}
+ onChange={change}
+ />
</div>
<div />
</div>
diff --git a/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx b/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx
index ad9b6389bc..ff1bfe3b06 100644
--- a/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx
+++ b/saleor/static/dashboard-next/components/SeoForm/SeoForm.tsx
@@ -20,7 +20,6 @@ interface SeoFormProps {
helperText?: string;
title: string;
titlePlaceholder: string;
- storefrontUrl?: string;
onChange(event: any);
onClick?();
}
@@ -73,10 +72,12 @@ const SeoForm = decorate<SeoFormProps>(
({
classes,
description,
+ descriptionPlaceholder,
disabled,
helperText,
loading,
title,
+ titlePlaceholder,
onChange
}) => (
<Toggle>
@@ -121,6 +122,7 @@ const SeoForm = decorate<SeoFormProps>(
value={title.slice(0, 69)}
disabled={loading || disabled}
InputLabelProps={{ shrink: true }}
+ placeholder={titlePlaceholder}
onChange={onChange}
fullWidth
/>
@@ -148,6 +150,7 @@ const SeoForm = decorate<SeoFormProps>(
disabled={loading || disabled}
fullWidth
multiline
+ placeholder={descriptionPlaceholder}
InputLabelProps={{ shrink: true }}
rows={10}
/>