Skip to main content

Replace all Usages of a PageRef with another PageRef

Comments

2 comments

  • Zendesk API User
    Author: mbergmann - 8/1/2022 12:21

    Hi Mareike, 

    if your intention would just be to "replace" an old PageRef with a (new) one, an idea would be to keep the exsting one but let it point to another content page (green) and just move the PageRef to the "new" location - but I assume that's not your use case... or might this also be an option?

    If not: To my knowledge, there's no easy way to replace a PageRef just "everywhere".

    Background: You would have to iterate not only into pages and sections but also into INPUT_DOMs (inline links), FS_CATALOGs (and their inner DOMs) and change all their FormData (change the value of all FS_REFERENCE's) so there would be quite some cases to handle. 

    Depending on "where most of those PageRefs [more precisely: The FS_REFERENCES] are": Iterating through pages/sections and replace the PageRef in those FS_REFERENCES that are "at the top level form" (=page templates and section templates) should be quite easy/generic. So it might be an approach to start with those "simple" cases.

    Michael

    0
  • Zendesk API User
    Author: mareike - 8/1/2022 12:44

    Hi Michael,

    thanks for your reply. Using the old PageRef and reference another page is not an option here because multiple pages get replaced by one new page and the old urls should be completely deleted (we also want to tidy up our PageRefs).

    Sadly, many of the FS_REFERENCES are inside INPUT_DOMS and FS_CATALOGS. If someone has a script or a script for a similar use case it would be really helpful to post it here so we don't have to start from scratch.

    Mareike

    0

Please sign in to leave a comment.