import { SearchSnippetPreview } from '@components/admin/SearchSnippetPreview.js'; import { InputField } from '@components/common/form/InputField.js'; import { TextareaField } from '@components/common/form/TextareaField.js'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@components/common/ui/Card.js'; import { _ } from '@evershop/evershop/lib/locale/translate/_'; import React from 'react'; import { useWatch } from 'react-hook-form'; interface CmsPageSeoProps { page?: { name?: string; urlKey?: string; metaTitle?: string; metaKeywords?: string; metaDescription?: string; }; } // Live SERP preview. CMS pages are served at the root (`/`), so the // prefix is `/`. Watches the SEO fields plus `name` (registered on the General // tab — same form) so the snippet updates as the merchant types; falls back to // the persisted name for the title when the meta title is blank. function SnippetPreview({ name }: { name?: string }) { const urlKey = useWatch({ name: 'url_key' }); const metaTitle = useWatch({ name: 'meta_title' }); const metaDescription = useWatch({ name: 'meta_description' }); const watchedName = useWatch({ name: 'name' }); return ( ); } export default function Seo({ page }: CmsPageSeoProps) { return ( {_('SEO Information')} {_('Provide the SEO details for the CMS page.')}
); } export const layout = { areaId: 'wideScreen', sortOrder: 30 }; export const query = ` query Query { page: cmsPage(id: getContextValue('cmsPageId', null)) { name urlKey metaTitle metaKeywords metaDescription } } `;