Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Dynamics 365 Portal-Blog Functionality

(0) ShareShare
ReportReport
Posted on by 25

Hi all, 

I want to hide some sections in the Blog Post in the Dynamics 365 Portal. But there is no Webpage corresponding to it. Can anyone help how and where can I insert the code ? I'm attaching the pic of the section I want to hide ?

pastedimage1586458514495v1.png

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Dynamics 365 Portal-Blog Functionality

    Hi Kirat,

    It seems that there is no Web Page record for us to edit Blog post page.

    Making change to theme.css may not work because the section element hasn't a specific id or class name attribute. 

    So a solution would be that we could add a custom javascript on a global scope element: Header.

    pastedimage1586760265387v1.png

    var path = location.pathname;
    if (path.indexOf("blogs") > -1 || path.indexOf("news") > -1) {
        document.getElementsByClassName("content-panel")[0].style.display = "none";
    }

    Because URL of blog page starts with "blogs",

    and blog post's starts with: "news/{title}"

    location.pathname will search pathname of web site, then we could search in the value whether any thing matches specific name.

    Our function will execute when page is loaded.(window.onload event)

    Result:

    When open blog post page with console for debugging, we can see that due to current path contains "news", so code in brackets will execute to hide specific section.

    pastedimage1586760791295v2.png

    pastedimage1586760876173v3.png

    Regards,

    Clofly

  • Kirat13 Profile Picture
    Kirat13 25 on at
    RE: Dynamics 365 Portal-Blog Functionality

    Thankyou so much for your quick response and your solution worked like a charm for the Blogs.

    The only issue I'm facing now is that whenever a new Blog is created it has associated Blog posts with it, and these sections would pop up on the Blog Posts even if we hide it on the Blog. Would you recommend making changes to the theme.css to make it happen for the Blog Posts or is there any other effective way?

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Dynamics 365 Portal-Blog Functionality

    In addition, you can also hide it with pure css rule:

    div .content-panel:nth-child(2) {
        display: none;
    }

    pastedimage1586499827227v1.png

    Please notice that if we hide element by javascript, the start index is 0,

    if css, the value starts from 1.

    Regards,

    Clofly

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Dynamics 365 Portal-Blog Functionality

    Hi Kirat,

    Please follow steps below to hide a specific section.

    1. In blog web page, open console and find correct index number of section which you would like to hide:

    e.g: hide "Options", its index equals 1:

    pastedimage1586497774134v1.png

    2. In Web Page > Information form of blog page, double click record in Localized Content.  

    pastedimage1586497870977v2.png

    3. It looks like we are still in same record, but actually the form has been changed to "Content"; open Advanced tab to add custom javascript code.

    pastedimage1586498102716v3.png

    It will hide section element which its index equals 1.(I added an alert to test whether it would work.)

    $('.content-panel').eq(1).hide();

    pastedimage1586498141819v4.png

    4. Save the modified record, and if update not works, click "Browser website" button in PowerApps portal editor to refresh cache.

    pastedimage1586498261240v5.png

    5. Then when we open blog page again, it will firstly show alert.

    pastedimage1586498381174v6.png

    after I close alert, the section will be hidden.

    pastedimage1586498446380v7.png

    Regards,

    Clofly

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans