Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shaverion 1 post 71 karma points
    Nov 10, 2021 @ 20:19
    Shaverion
    0

    We use USync to sync content from test, to acceptance to production. This works great except for links to external applications. These links point the the corresponding environment of ours. So when published the links on production will point to acceptance environments.

    We are looking for a way to transform links and maybe other content like email addresses when publishing the content via USync. A simple string replace in all published content would be sufficient. Is there anything like that already build? And if not where could I extent USync of Umbraco to make this happen?

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Nov 10, 2021 @ 22:06
    Kevin Jump
    0

    Hi,

    I would probibly go with using the events uSync files when it imports items.

    if you hook into the ImportingItem event, you could - do a search and replace on the xml element that is passed, updating any links from your acceptance to production urls.

    in a Compoent Intialize event (example)- you can register for the ImportingItem event.

    uSyncService.ImportingItem += USyncService_ImportingItem;
    

    then in the event you could read in the xml, do some replacements and put the xml back (i think! - haven't actually tried this code)

    private void USyncService_ImportingItem(uSyncItemEventArgs<XElement> e)
    {
       var xml = e.Item.ToString();
       xml = xml.Replace(acceptanceUrl, productionUrl);
       e.Item = XElement.Parse(xml);
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft