Just trying out the new wix-seo module ( https://www.wix.com/corvid/reference/wix-seo.html ) works ok on static pages, but getting weird behaviour on dynamic pages… If you use setTitle() on a dynamic page, all subsequent dynamic pages use the previous dynamic page title! Code:
$w.onReady(function () {
$w('#datasetDynamicPage').onReady(() => {
let pageData = $w('#datasetDynamicPage').getCurrentItem()
// Check for custom SEO Meta Title, and apply if checked
if (pageData.customMetaTitleFlag) {
wixSeo.setTitle(pageData.customMetaTitle)
.then(() => {
console.log("title set");
})
.catch(() => {
console.log("failed setting title");
});
}
First, if the customMetaTitleFlag = false, then the page title isn’t overwritten and so the normal template title is used - this works fine.
Then if a page is loaded with a custom title (customMetaTitleFlag = true), the module overwrites the title with customMetaTitle, this works fine - so far so good!
BUT, then any subsequent dynamic pages all use the last custom title. Even if customMetaTitleFlag = false.
Not getting any code errors. Checked “Site Events” and “title set” is only shown when customMetaTitleFlag = true.