Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Portals - change customization of default SEARCH page

(0) ShareShare
ReportReport
Posted on by 5

Hi

I am struggling to remove a whole section form the SEARCH page.  there is a section  called 

<h1 class="section-landing-heading"><div class="xrm-editable-html xrm-attribute" data-cmstemplate-render-url="/_services/portal/7b138792-1090-45b6-9241-8f8d96d8c372/adx_contentsnippet/0ccb8a6f-d924-4925-96cc-987677e95564/__templates/live-preview/L3NlYXJjaC8%3d" data-cmstemplate-url="/_services/portal/7b138792-1090-45b6-9241-8f8d96d8c372/adx_contentsnippet/0ccb8a6f-d924-4925-96cc-987677e95564/__templates/all/L3NlYXJjaC8%3d" data-editable-title="Search/Title" data-editable-url="/_services/portal/7b138792-1090-45b6-9241-8f8d96d8c372/adx_contentsnippet/0ccb8a6f-d924-4925-96cc-987677e95564/adx_value" data-encoded="false" data-filebrowser-dialog-url="~/xrm-adx/filebrowser.html" data-filebrowser-url="/_services/portal/7b138792-1090-45b6-9241-8f8d96d8c372/elFinder/connector" data-label="Search/Title" data-languagecontext="English" data-liquid="true" data-xrm-base="/xrm-adx/"><div class="xrm-attribute-value">Discover contoso</div></div></h1>

I want to get rid of this whole section so i can use the space on the page. 

In the search web template I have added the following code 

<script>
$(document).ready(function(){
$(".section-landing-heading").hide();
});
</script>
But it does not work , I still get the whole white space.. I am newbie here so trying ot learn as i go along , can someone help me how to do that please ...
Currently the page looks like 
pastedimage1575909113524v1.png
doing f12 - and deleting the h1 element I get the below , which is what I am looking for .. 
pastedimage1575909214652v2.png
Any help please .. 
Thanks

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Portals - change customization of default SEARCH page

    Hi bik,

    If your web page is a rewrite type which custom code couldn't be embedded,

    pastedimage1575972911319v1.png

    Rewrite type couldn't be customized directly.

    pastedimage1575972934786v2.png

    then you could create a global js to detect URL path and then perform custom action:

    function hideElement() {
    
      var url = location.pathname;
    
      if (url.indexOf('search') > -1) {
    
        var header = document.getElementsByClassName('section-landing-heading');
    
        if (header.length > 0) {
          header[0].style.display = 'block';
        } else {
          console.log('no such element');
        } 
    
      }
    
    }
    
    document.addEventListener("DOMContentLoaded", hideElement);

    Regards,

    Clofly

  • bikmann Profile Picture
    bikmann 5 on at
    RE: Portals - change customization of default SEARCH page

    Hi  Nick

    Thank you, I got it working. the code needs to be put in the Content page ..  and it works.

    Thank you for the idea.

    Regards

    Bik

  • bikmann Profile Picture
    bikmann 5 on at
    RE: Portals - change customization of default SEARCH page

    Hi Thank you for that , I have tried doing what you have suggested, sadly that is not working  :(

     pastedimage1575967226530v1.png

    The part i am trying to get rid of is still visible

    pastedimage1575967419284v2.png

    Thanks 

  • Suggested answer
    Nicholas Hayduk Profile Picture
    Nicholas Hayduk 2,863 on at
    RE: Portals - change customization of default SEARCH page

    Hi,

    Your JavaScript code is fine - I suspect it's where you are putting that is the problem.  If you put it in the Search web template, this will appear in the header of the page, before jQuery is defined, which will cause a script error.

    I'd recommend moving your code to the Custom JavaScript attribute on the localized version of the Search Web Page.  Note that when you add it there, you don't need the <script> tag.

    Nick

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans