# Workaround: read the real SEO of dynamic and router pages (setTitle, setDescription)

**URL:** <https://forum.wixstudio.com/t/workaround-read-the-real-seo-of-dynamic-and-router-pages-settitle-setdescription/80237>\
**Category:** Ask the community\
**Tags:** wix-fetch, wix-web-module, seo, code\
**Created:** [October 16, 2026, 2:11pm UTC](https://forum.wixstudio.com/t/workaround-read-the-real-seo-of-dynamic-and-router-pages-settitle-setdescription/80237 "2026-10-16T14:11:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael-andrews](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/michael-andrews/32/110054_2.png) [@michael-andrews](https://forum.wixstudio.com/u/michael-andrews)\
**Post date:** [October 16, 2026, 2:11pm UTC](https://forum.wixstudio.com/t/workaround-read-the-real-seo-of-dynamic-and-router-pages-settitle-setdescription/80237/1 "2026-10-16T14:11:22Z")

</div>

Workaround: read the real SEO of dynamic and router pages (setTitle, setDescription)

Wix’s SEO API returns the default values for dynamic and router pages, even after you set them with setTitle(), setDescription() or setLinks(). There is a developer request for this on the Help Centre, still collecting votes.

Until Wix fixes it, here is a workaround. This backend web module reads the published page the way Google receives it, and returns what is really there: title, meta description, robots, canonical, hreflang links, og tags, H1 count and all structured data.

How to use it:

1. Add renderedSeo.web.js to your site’s backend.

2. Set SITE at the top to your own site address. It only reads pages on that site.

3. Call getRenderedSeo(“/your/page/path”) from your page code or backend.

Code attached. Happy to answer questions.

Michael Andrews, WixSEO

// backend/renderedSeo.web.js  
//  
// Reads the SEO a page really shows, including titles, descriptions and links set with  
// setTitle(), setDescription(), setLinks() and setStructuredData() on dynamic and router pages.  
// Wix’s SEO API returns the default values for those pages. This reads the published page  
// the way Google receives it instead, so you get what Google gets.  
//  
// Set SITE to your own site’s address. Only pages on that address can be read.

import { Permissions, webMethod } from “wix-web-module”;  
import { fetch } from “wix-fetch”;

const SITE = “[https://www.yoursite.com](https://www.yoursite.com)”; // your published site’s address, no slash at the end

const decode = (s) =\>  
String(s || “”)  
.replace(/&#x([0-9a-f]+);/gi, (_, h) =\> String.fromCodePoint(parseInt(h, 16)))  
.replace(/&#(\d+);/g, (_, d) =\> String.fromCodePoint(Number(d)))  
.replace(/“/g, '”‘)  
.replace(/’|‘/g, "’")  
.replace(/\</g, “\<”)  
.replace(/\>/g, “\>”)  
.replace(/&/g, “&”)  
.trim();

// Every attribute of one tag, for example .  
function attrs(tag) {  
const out = {};  
const re = /([a-zA-Z\_:.-]+)\s\*=\s\*(“([^”]_)"|‘([^’]_)')/g;  
let m;  
while ((m = re.exec(tag))) out[m[1].toLowerCase()] = decode(m[3] ?? m[4] ?? “”);  
return out;  
}

// The SEO in one page’s HTML.  
export function readSeoFromHtml(html) {  
const head = (html.match(/\<head[^\>]_\>([\s\S]_?)/i) || [null, html])[1];  
const metas = (head.match(/\<meta\b[^\>]_\>/gi) || []).map(attrs);  
const links = (head.match(/\<link\b[^\>]_\>/gi) || ).map(attrs);  
const meta = (key, value) =\> (metas.find((t) =\> (t[key] || “”).toLowerCase() === value) || {}).content || “”;  
const structuredData = ;  
const ld = /\<script[^\>]_type=[“']application/ld+json[”'][^\>]_\>([\s\S]_?)/gi;  
let m;  
while ((m = ld.exec(html))) {  
try {  
structuredData.push(JSON.parse(m[1]));  
} catch (e) {  
structuredData.push({ invalidJson: m[1].slice(0, 200) });  
}  
}  
return {  
title: decode((head.match(/\<title[^\>]_\>([\s\S]\*?)/i) || )[1] || “”),  
description: meta(“name”, “description”),  
robots: meta(“name”, “robots”),  
canonical: (links.find((l) =\> (l.rel || “”).toLowerCase() === “canonical”) || {}).href || “”,  
alternates: links  
.filter((l) =\> (l.rel || “”).toLowerCase() === “alternate” && l.hreflang)  
.map((l) =\> ({ hreflang: l.hreflang, href: l.href })),  
ogTitle: meta(“property”, “og:title”),  
ogDescription: meta(“property”, “og:description”),  
ogImage: meta(“property”, “og:image”),  
h1Count: (html.match(/\<h1\b/gi) || ).length,  
structuredData,  
};  
}

// Read one page on this site by its path, for example “/products/blue-mug” or “/team/sarah”.  
export const getRenderedSeo = webMethod(Permissions.Anyone, async (path) =\> {  
const clean = “/” + String(path || “”).replace(/^https?://[^/]+/i, “”).replace(/^/+/, “”);  
const url = new URL(clean, SITE);  
if (url.origin !== new URL(SITE).origin) throw new Error(“Only pages on this site can be read.”);  
const res = await fetch(url.href, { method: “get”, headers: { “User-Agent”: “Mozilla/5.0 (compatible; RenderedSeo/1.0)” } });  
if (!res.ok) return { url: url.href, status: res.status, error: “That page didn’t load.” };  
return { url: url.href, status: res.status, …readSeoFromHtml(await res.text()) };  
});
