Skip to main content

SEO and Meta Tags

Every page in your theme needs SEO meta tags. Dukanext provides an endpoint that returns the correct title, description, and Open Graph data for any URL in your theme.

How it works

POST /access/api/v1/config

You send the URL pattern and (for dynamic pages) the page's identifier. The API returns the meta tags to inject into <head>.

Static pages

For pages with a fixed URL (home, contact, newsletter, etc.):

Request:

{ "url": "/" }
{ "url": "/contact-us" }
{ "url": "/newsletter/unsubscribe" }

Dynamic pages

For pages driven by a slug or ID, pass the param field with the identifier:

Product page:

{ "url": "/product/:id", "param": "running-shoes" }

Collection page:

{ "url": "/collections/:id", "param": "footwear" }

Policy page:

{ "url": "/support/:id", "param": "privacy" }

Supported URL patterns

Patternparam value
/none
/shopnone
/product/:idproduct slug or ID
/collections/:idcategory slug
/support/:idpolicy type (privacy, terms, refund, pricing)
/searchsearch term
/checkout/successnone
/contact-usnone
/newsletter/unsubscribenone
/newsletter/verifynone
/bagnone
/wish-listnone
/checkoutnone
/dashboardnone
/dashboard/ordersnone
/dashboard/orders/:idnone
Any other static URLnone

Response

{
"status": "success",
"data": {
"title": "Where Everyday Becomes Exceptional",
"description": "Discover a curated world of quality, design, and convenience.",
"icons": {
"icon": [{ "url": "https://...", "type": "image/png" }]
},
"metadataBase": "http://yourstore.com/",
"author": "Shop Name",
"keywords": "shop name, e-commerce, dukanext, discounts",
"charSet": "UTF-8",
"openGraph": {
"type": "website",
"images": ["https://..."],
"title": "Where Everyday Becomes Exceptional",
"description": "Discover a curated world of quality, design, and convenience.",
"url": "http://yourstore.com/"
}
}
}

The response is already shaped for Next.js generateMetadata — spread or pick the fields you need.

Next.js example

In Next.js App Router, call this from generateMetadata on the server so the tags are in the initial HTML:

// app/product/[id]/page.jsx
export async function generateMetadata({ params }) {
const res = await fetch(`${BASE_URL}/config`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.DUKANEXT_API_KEY,
},
body: JSON.stringify({ url: '/product/:id', param: params.id }),
});

const { data } = await res.json();

return {
title: data.title,
description: data.description,
openGraph: {
title: data.title,
description: data.description,
images: data.openGraph?.images || [],
},
};
}
// app/page.jsx (home)
export async function generateMetadata() {
const res = await fetch(`${BASE_URL}/config`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'x-api-key': process.env.DUKANEXT_API_KEY },
body: JSON.stringify({ url: '/' }),
});
const { data } = await res.json();
return { title: data.title, description: data.description };
}

Call this server-side (SSR or SSG), not in a useEffect. Meta tags must be in the initial HTML response to be picked up by crawlers.

Sitemap

GET /access/api/v1/config/site-map

Returns an array of all public URLs — every active product, category, and static page. Each entry is already shaped for Next.js's sitemap format.

Response:

{
"status": "success",
"data": [
{ "url": "http://yourstore.com", "lastModified": "2026-04-22T21:29:23.077Z", "changeFrequency": "weekly", "priority": 1 },
{ "url": "http://yourstore.com/shop", "lastModified": "2026-04-22T21:29:23.077Z", "changeFrequency": "weekly", "priority": 0.9 }
]
}

Next.js example:

// app/sitemap.js
export default async function sitemap() {
const res = await fetch(`${BASE_URL}/config/site-map`, {
headers: { 'x-api-key': process.env.DUKANEXT_API_KEY },
});

const { data } = await res.json();
return data; // already in Next.js sitemap shape
}

Possible errors

CodeMeaning
HOSTNAME_NOT_DETERMINEDCould not determine the request hostname
DOMAIN_NOT_IDENTIFIEDDomain not identified
SHOP_ID_NOT_FOUNDCould not resolve shop from domain
SHOP_URL_INVALIDURL provided is not valid