diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-31 13:35:01 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-31 13:35:01 +0700 |
| commit | 8942f55ec23c0f663fac797ef4f2c284b3bd98fb (patch) | |
| tree | 882aa1241f4e981873fcae1c0d4387e079c1ff89 /src/core/components | |
| parent | a67436efc99bccd9771d9ae82cda33497b1c62c8 (diff) | |
| parent | 6b4c47641315d0b7de5ca2c3d029c69068f7cac8 (diff) | |
Merge branch 'new-release' of https://bitbucket.org/altafixco/next-indoteknik into cr_prod_card
merge
Diffstat (limited to 'src/core/components')
| -rw-r--r-- | src/core/components/Seo.jsx | 66 |
1 files changed, 17 insertions, 49 deletions
diff --git a/src/core/components/Seo.jsx b/src/core/components/Seo.jsx index 66da395b..24d8c545 100644 --- a/src/core/components/Seo.jsx +++ b/src/core/components/Seo.jsx @@ -1,64 +1,32 @@ -import { useRouter } from 'next/router'; import { NextSeo } from 'next-seo'; +import { useRouter } from 'next/router'; -const Seo = (props) => { +const Seo = ({ ...props }) => { const router = useRouter(); - const { - canonical, - description, - additionalMetaTags = [], - openGraph = {}, - ...restProps - } = props; - - const origin = (process.env.NEXT_PUBLIC_SELF_HOST || '').replace(/\/+$/, ''); - - const asPath = router.asPath || ''; - - const [cleanPath] = asPath.split('?'); - - const queryObj = router.query || {}; - - const isSearchPage = cleanPath.startsWith('/search'); - - const buildFallbackCanonical = () => { - if (isSearchPage) { - const q = queryObj.q; - if (q) { - return origin + cleanPath + `?q=${encodeURIComponent(String(q))}`; - } - return origin + cleanPath; - } - - return origin + cleanPath; - }; - - const resolvedCanonical = canonical || buildFallbackCanonical(); - - const mergedAdditionalMetaTags = [ - { - property: 'fb:app_id', - content: '270830718811', - }, - { - property: 'fb:page_id', - content: '101759953569', - }, - ...additionalMetaTags, - ]; + const { additionalMetaTags = [], openGraph = [], title = '' } = props; return ( <NextSeo defaultTitle='Indoteknik.com: B2B Industrial Supply & Solution' - canonical={resolvedCanonical} - description={description} - {...restProps} + canonical={process.env.NEXT_PUBLIC_SELF_HOST + router.asPath} + description={title} + {...props} openGraph={{ siteName: 'Indoteknik.com', ...openGraph, }} - additionalMetaTags={mergedAdditionalMetaTags} + additionalMetaTags={[ + { + property: 'fb:app_id', + content: '270830718811', + }, + { + property: 'fb:page_id', + content: '101759953569', + }, + ...additionalMetaTags, + ]} /> ); }; |
