In a lot of our projects we create a class or a struct with static properties which contain references to specific pages. This is very helpful because this reference is a unique ID. This gives us the ability to move a page in the tree without breaking links. In EPiServer we're using the Page ID:
The PageReference or ContentReference is also used in the ContentRepository so I guess this way is the suggested way to approach this.
However, when you deploy content to a different environment within the DTAP street, the ID changes which breaks our functionality. I tried using a pages GUID, but this also won't work.
Moving these properties to a config file is not very clean so I want to avoid that. Is there any way to persist the Page ID of a page when installing the content on a new environment? Or is there a best practice for this?
Hope somebody can help. How are you doing this?
I guess you deploy the content in an episerver export package (.episerverdata file)?
If so then the Content Guids should remain the same if you set flag
DataImporter.KeepIdentity = true;
You could add pagereference properties for these pages on the start page, instead of having them hardcoded in class or config file. Then have a static helper class where you can retrieve these.