Should I pin the slot version in fetchContent or is leaving it off fine?
Some examples use a slot id like home-hero@2 and others just the bare home-hero. What is the practical difference between the two?
We publish content changes pretty often and I want to know which is safer for a team like ours. If I leave the version off does something change under me without a deploy, or is it fine to skip it.
2 answers
On production routes I pin, every time. A bare id like home-hero resolves to @latest, so the moment someone publishes a content or schema change it takes effect against your running code. If that change adds or renames a field your components read, the deployed build can break without anyone touching a deploy.
Pinning like home-hero@2 keeps your code on a known version until you bump the number deliberately. Older versions keep serving after a new one is published, so it is a genuine rollout lever: you publish v3, verify it, and change the pin in code as a normal reviewed change.
There is a second reason to be explicit. Preview links only render when the slot version in your code matches the one the preview was generated for, so an unpinned slot can quietly show default content in preview. More on that in why a preview link shows default content.
makes sense, we publish too often to leave it on latest in prod. pinning and treating the bump as a reviewed change it is. thanks
Half agree. For a production app pinning is the right call. But when I am prototyping and the schema is still moving every day, @latest saves me from bumping a number on every single content tweak, since there is no real traffic to break yet. I just switch to pinned versions before the thing ships to anyone.