none
Want to remove some text from sub site pages

    Question

  • Hi Guys,

    I have more than 200 sub sites, in each sub site page i have to remove some hard coded text, i am able to do it manual but i want to do it through power shell script if its possible?

    Please suggest me how to remove hard coded test from all sub sites pages.

    I want to remove red circle text and want result like below

    <a href="/BowieTownCenter/Pages/EmergencyManagement.aspx">Emergency Contacts</a>

    Thursday, April 18, 2019 11:11 AM

All replies

  • Hi,

    You could remove the absolute site url using Jquery like this, add the script to master page so that it will apply to all site pages:

    <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.0.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $('a[href*="4599"]').each(function( index ) {
      var newhref= $( this ).attr('href').split('4599')[1];
      console.log(newhref);
      $(this).attr('href',newhref);
    });
    
    });
    </script>
    <a href="http://sp:4599/BowieTownCenter/Pages/EmergencyManagement.aspx">Emergency Contacts</a><br/>
    <a href="http://sp:4599/BowieTownCenter/Pages/EmergencyManagement1.aspx">Emergency Contacts1</a>
    

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, April 19, 2019 6:04 AM
  • Hi,

     

    I am checking to see how things are going there on this issue. Please let us know if you would like further assistance.

     

    You can mark the helpful post as answer to help other community members find the helpful information quickly.

     

    Thanks

     

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, April 24, 2019 12:50 AM