JuniorNext.js

What are a sitemap, the canonical tag and JSON-LD used for in technical SEO?

The interviewer wants to know whether you understand what problem each piece solves, rather than just knowing the names and copying a configuration.

A sitemap is an XML file that lists the addresses on your site, so that search engines can find pages without following every link. Google's guidance says they ignore priority and changefreq, and use lastmod only when the value always matches the page's real last change. Every value in the file must have XML special characters escaped.

The canonical tag says which address is the main copy of a piece of content. When the same article can be reached at several addresses (with tracking parameters, with or without a trailing slash), canonical helps search engines group them into one. For a multilingual page, each version points its canonical at itself and lists the other versions with hreflang.

JSON-LD is a block of structured data (using the schema.org vocabulary) that says the page is an article, who the author is and when it was published. When you embed it in a script tag, replace the < character with <, because JSON.stringify does not sanitize strings and a title containing </script> could break out of the tag.

One practical note: none of these guarantees a top ranking, they only help search engines understand the page correctly. Preview environments need noindex, and only production should be indexed.

Bonus points: mention that a sitemap can also be wrong in ways that are hard to see, for example when it is served as a static file and so does not update when a new post goes out, and that you should have a way to check that on a live environment.