Check 44.12 · Redesign and migration

Preserve structured data, entity identifiers and important anchors

Keep structured data, entity @id values, sameAs links and cited anchors through a redesign, with a comparison script and fixes.

Priority
Critical
Difficulty
Advanced
Estimated time
1 to 3 days
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

A redesign replaces the templates, and with them the invisible markup that search engines read: the Schema.org JSON-LD (JavaScript Object Notation for Linked Data) blocks, the @id identifiers that connect the organization, the website, the pages and the authors, the sameAs links to official profiles, and the id attributes that act as anchors for links such as /guide/#etape-3. This task inventories them on the old site and checks that they survive unchanged on staging. Once it is done, every page type keeps its structured data, every entity keeps its @id, and every cited anchor still exists.

Why it matters

Structured data helps Google understand a page and makes it eligible for certain rich results (products, breadcrumbs, articles). A new theme or a switch of SEO plugin changes it without anything changing on screen: the offers properties disappear from a product page, the BreadcrumbList is no longer generated, the author is no longer connected to their page. The rich result reports in Search Console show this, but only after the fact.

@id values are identifiers: they say “this organization is the same as the one described on the other pages”. When they change with every redesign, or become relative by mistake, the site's entity graph fragments. Search engines do not document their specific effect on rankings or citations; keeping them stable is a matter of data consistency, which search engines and AI systems use to connect a brand to its information.

Anchors are the most frequently forgotten case. External sites, documentation and AI assistant answers sometimes link to a specific section. The fragment (#etape-3) is never sent to the server: no redirect rule can handle it. On the other hand, the HTTP specification provides that a redirect without a fragment keeps the fragment of the original request: /ancien-guide/#etape-3 redirected to /guide/ ends up at /guide/#etape-3. The anchor must therefore exist on the new page.

What it improves

  • Rich results The page types that benefited from them keep them.
  • Entity consistency The organization, website, authors and products keep the same identifier in the graph.
  • Deep links and citations Links to a specific section still lead to that section.
  • Search Console reports No sudden drop in valid items after launch.
  • Rankings and AI citations Indirect, unmeasured effect; above all, the task avoids breaking what was working.

How to check

On a page, extract the declared types and @id values:

curl -s https://www.example.com/ | grep -oE '"@(type|id)": ?"[^"]+"' | sort -u

Expected result on staging: the same lines, apart from the hostname. The Rich Results Test and the Schema Markup Validator accept pasted code, which is useful for a protected staging site: copy the page source from your logged-in browser.

To compare a sample of pages, save this script as comparer.py, put the paths to check in pages.txt (at least one page per template, plus every page with linked anchors), then run python3 comparer.py.

import base64
import json
import urllib.request
from html.parser import HTMLParser

ANCIEN = "https://www.example.com"
NOUVEAU = "https://preprod.example.com"
ACCES_PREPROD = "utilisateur:motdepasse"


class Lecteur(HTMLParser):
    def __init__(self):
        super().__init__()
        self.ancres = set()
        self.blocs = []
        self.tampon = None

    def handle_starttag(self, tag, attrs):
        attrs = dict(attrs)
        if attrs.get("id"):
            self.ancres.add(attrs["id"])
        if tag == "script" and attrs.get("type") == "application/ld+json":
            self.tampon = []

    def handle_data(self, data):
        if self.tampon is not None:
            self.tampon.append(data)

    def handle_endtag(self, tag):
        if tag == "script" and self.tampon is not None:
            self.blocs.append("".join(self.tampon))
            self.tampon = None


def entites(objet, trouvees):
    if isinstance(objet, list):
        for element in objet:
            entites(element, trouvees)
    if isinstance(objet, dict):
        if "@type" in objet:
            trouvees.add((str(objet["@type"]), objet.get("@id", "")))
        for valeur in objet.values():
            entites(valeur, trouvees)
    return trouvees


def analyser(url, acces=None):
    requete = urllib.request.Request(url, headers={"User-Agent": "controle-migration"})
    if acces:
        jeton = base64.b64encode(acces.encode()).decode()
        requete.add_header("Authorization", f"Basic {jeton}")
    with urllib.request.urlopen(requete) as reponse:
        html = reponse.read().decode("utf-8", errors="replace")
    lecteur = Lecteur()
    lecteur.feed(html)
    trouvees = set()
    for bloc in lecteur.blocs:
        entites(json.loads(bloc), trouvees)
    return lecteur.ancres, trouvees


with open("pages.txt") as fichier:
    for chemin in (ligne.strip() for ligne in fichier if ligne.strip()):
        ancres_avant, entites_avant = analyser(ANCIEN + chemin)
        ancres_apres, entites_apres = analyser(NOUVEAU + chemin, ACCES_PREPROD)
        entites_apres = {(t, i.replace(NOUVEAU, ANCIEN)) for t, i in entites_apres}
        for type_, id_ in sorted(entites_avant - entites_apres):
            print(f"{chemin}\tlost entity\t{type_}\t{id_}")
        for ancre in sorted(ancres_avant - ancres_apres):
            print(f"{chemin}\tlost anchor\t#{ancre}")

No output lines: nothing was lost. The script only reads the JSON-LD present in the initial HTML; if the new site injects it with JavaScript, check it with URL Inspection or the Rich Results Test. If the paths change, replace pages.txt with pairs of old and new URLs.

How to implement

Before you start

Draw up three inventories of the old site in a single spreadsheet:

  1. Structured data by template: for each page type (homepage, category, product, article, local page, FAQ), the Schema.org types present and their properties. The reports in the Search Console “Enhancements” section list the types Google detects; Screaming Frog also extracts them during a crawl.
  2. Entity identifiers: the @id of the organization, the website, the authors and the business locations, and the list of sameAs links. They must follow a written convention, described in use stable @id values (opens in a new tab).
  3. Important anchors: the fragments in the URLs of the backlink export (opens in a new tab) (search for #), in internal links, in tables of contents, and in the URLs cited by AI assistants recorded when identifying pages cited by AI systems (opens in a new tab).

Rules to pass on to the developers:

  • Same domain: every @id stays identical down to the character, trailing slash included.
  • Domain change: all @id values move to the new domain at the same time, with the same pattern (https://www.example.com/#organization), and external profiles (social networks, Wikidata, business listings) are updated to point to the new site.
  • Structured data: each template keeps at least the types and properties of the old one, and this markup stays consistent with the visible content; see align markup with visible content (opens in a new tab).
  • Anchors: every inventoried id exists on the page that takes over the content. An id generated from the heading text changes as soon as the heading is reworded: freeze it.

WordPress

Versions WordPress 6.4 and later, Yoast SEO and Rank Math (current versions).

  • Structured data: Yoast SEO and Rank Math generate a JSON-LD graph whose @id values derive from the site URL. Keeping the same plugin and the same configuration (whether the site represents an organization or a person, name, logo, profiles) keeps the same identifiers. Switching plugins changes the @id pattern and often the list of types: compare before switching.
  • Theme: a theme that adds its own JSON-LD creates duplicates with the plugin. The checking script reveals them.
  • Anchors: in the block editor, select the Heading block, then in the Block > Advanced panel, use the “HTML anchor” field. Enter the old identifier there. Table of contents plugins often generate anchors from the text: check that they produce the same ones as the old site, or set them by hand on the cited sections.

Shopify

Versions Shopify, Online Store 2.0 themes, November 2026.

Structured data comes from the theme (Liquid files, often in the product and article sections) and from installed apps. A change of theme or of reviews app therefore changes the markup: before publishing the new theme, preview it, copy the source of a product page and an article, and run it through the Rich Results Test. For anchors, the rich text editor lets you switch to HTML view and add an id attribute to headings.

Laravel

Versions Laravel 12 and 13.

Build the identifiers in one place, from the production URL, and never in each view:

<?php

namespace App\Support;

class SchemaIds
{
    public static function organization(): string
    {
        return config('app.url').'/#organization';
    }

    public static function website(): string
    {
        return config('app.url').'/#website';
    }
}

In the view, encode the PHP array rather than writing the JSON by hand:

<script type="application/ld+json">
{!! json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG) !!}
</script>

APP_URL must be set to the production URL in production, without a trailing slash. For anchors, store each section's identifier in the database or in the Markdown content, rather than recalculating it from the heading on every render.

Next.js

Versions Next.js 15 and 16 (App Router).

Render the JSON-LD on the server, in the page or the layout, as the Next.js documentation recommends:

const siteUrl = 'https://www.example.com';

export default function Page() {
  const jsonLd = {
    '@context': 'https://schema.org',
    '@graph': [
      { '@type': 'Organization', '@id': `${siteUrl}/#organization`, name: 'Example', url: siteUrl },
      { '@type': 'WebSite', '@id': `${siteUrl}/#website`, url: siteUrl, publisher: { '@id': `${siteUrl}/#organization` } },
    ],
  };

  return (
    <script
      type="application/ld+json"
      dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd).replace(/</g, '\\u003c') }}
    />
  );
}

If content goes through MDX or Markdown with rehype-slug, heading id values are computed from their text: rewording a heading changes the anchor. For cited sections, write the id explicitly in the content.

Keeping a renamed anchor

When a section is renamed, keep the old identifier without JavaScript by placing it on the element that wraps the section:

<section id="tarifs-2025">
  <h2 id="tarifs">Pricing</h2>
  <p>…</p>
</section>

Links to #tarifs-2025 and #tarifs lead to the same place. Text fragments (#:~:text=…), which some search engines add to links, depend on no id but on the exact text: if the passage is reworded, the page simply opens at the top. Keeping the most cited passages intact avoids this loss; see add stable anchors (opens in a new tab).

Common mistakes

  • Switching SEO plugins during the redesign without comparing the graph it produces: @id values, types and properties all change at once.
  • Relative @id values (#organization): they are resolved against each page and create as many entities as there are pages.
  • Leaving the staging hostname in @id, url or sameAs values pushed to production.
  • Duplicate markup between theme, plugin and app: two different Product or Organization entities on the same page.
  • Anchors recalculated from text: a reworded heading breaks every link that pointed to the section.
  • Relying on a server redirect for an anchor: the fragment never reaches the server.
  • Removing sameAs links because the new footer template no longer shows some social networks.

Frequently asked questions

Is structured data kept when you change themes?

Not necessarily. On WordPress, Shopify or any other CMS, part of the JSON-LD comes from the theme and part from plugins or apps. Changing themes can remove properties, such as a product's offers, or create duplicates with the SEO plugin. Compare the markup of each page type on the old theme and the new one, using the Rich Results Test, before launch.

Should Schema.org @id values change when you change domains?

Yes, because an @id is an absolute URL built on the domain. Move all identifiers to the new domain at the same time and with the same pattern, for example the homepage URL followed by #organization, on every page. Also update the external profiles listed in sameAs, as well as business listings and Wikidata, so that they point to the new site.

Can you redirect an anchor such as #section to a new page?

Not on the server side: the fragment after the # is never sent to the server, so no Apache, Nginx or CDN rule can read it. A page redirect does keep it, however, if the new address has no fragment. For a link to an anchor to work after the redesign, the identifier must exist on the new page, for example on the element that wraps the renamed section.

How do you find out which anchors on your site are being used?

Search for the # character in the backlink export, in the internal links collected by a crawl and in the URLs that AI assistants cite when you test them. Analytics tools do not see fragments by default, since they are not sent to the server. Add the identifiers from the tables of contents of your long-form content: these are the most frequently shared anchors.

Updated on

Topic checklist (PDF)

And now?

In the “Redesign and migration” topic

  1. Crawl the site before the redesign
  2. Export URLs and metadata
  3. Export Search Console and analytics data
  4. Export backlinks
  5. Identify revenue-generating pages
  6. Identify pages cited by AI systems
  7. Identify strategic pages to preserve
  8. Keep high-performing URLs if possible
  9. Create a comprehensive redirect map
  10. Map old URLs to relevant equivalents
  11. Preserve strategic content and internal links
  12. Preserve structured data, entity identifiers and important anchors
  13. Protect and audit the staging site
  14. Test performance before launch
  15. Test redirects
  16. Check canonicals, hreflang, sitemaps and robots.txt
  17. Remove indexing blocks on the live site
  18. Check tracking
  19. Submit new sitemaps
  20. Use Google's Change of Address tool if applicable
  21. Crawl the site after launch
  22. Monitor critical errors daily
  23. Monitor rankings, traffic and AI citations
  24. Keep redirects for at least a year, ideally longer
  25. Prepare a rollback plan