How to hide the Title and URL Name fields from Article detail component on community - Answers - Salesforce Trailblazer Community
Ask Search:
Hayk HovhannisyanHayk Hovhannisyan 

How to hide the Title and URL Name fields from Article detail component on community

Hi all, 
For some reason unauthenticated guest users in our community can see the "Title" and "URL Name" fields on Articles on the community. We use the Napili template that includes OOTB Article detail component. 
We would like to hide the Title and URL Name fields from public view. 
Now.. the Guest User profile has Read and Edit access to those fields on Knowledge object.
When going to modify access, I can't take-off checks from checkboxes on. Any idea how could I control Guest user Profiles access to to these fields, or maybe define and switch the community to a different profile that would not have read access to Title and URL Name fields?
Best Answer chosen by Ed (salesforce.com) 
Carol CiceroneCarol Cicerone
After reading through the commuinty and stackexchange cases, our Salesforce Admin actually ended up implementing this alternative solution:

"(Worried about how displaying articles in a custom component would affect our view statistics and ability to turn on voting). I am sure all of that can be coded around, but then it would have become a much bigger undertaking. Eventually what I settled on was some CSS to hide the title and url name: 

article.content .forcePageBlockSectionRow ~ .forcePageBlockSectionRow{
    display:none;
}

This is a bit of a hack - it just hides everything but the first field in the article. So if we just use this, then articles should only have one publicly available field, which I think is okay for our purposes, but let me know if you disagree and you'd still like a custom component. We also always need page layouts to show the article body first. 

I also took the liberty of adding some more CSS to hide some things I think we don't want: 

Hide the field label ("Article Body")   
.test-id__field-label{
    display:none;
}

Hide the login/username and profile info (I am hiding the stuff inside the div because otherwise it messes with the position of the search bar) 
.cProfileCon > div{
display:none;
}

The CSS is in the theme section, Colors>Edit CSS"
 

All Answers

EdEd (salesforce.com) 
Hi Hayk,

How about creating a new page layout for the Article Type without the URL Name and Title, then have this assigned to the Guest User Napili profile?

I hope this helps!
Hayk HovhannisyanHayk Hovhannisyan
Hi Ed, 
Unfortunately, those two standard fields Salesforce sets as required on any new page layout I create.
Devan BarnardDevan Barnard
Did you ever find a solution to this? I just upgraded to lightning knowledge and having the same problem.
Nick HoffNick Hoff
according to the knowledge base set up guide the URL name field is not supposed to show when viewing an article, however i am having an issue with this not being the case. has anyone been able to fix this situation?

This is the article i am referring to:
https://resources.docs.salesforce.com/202/latest/en-us/sfdc/pdf/salesforce_knowledge_implementation_guide.pdf
Jeroen BurgersJeroen Burgers
Nick, the issue is specific to Lightning Knowledge articles exposed on a Napili-based community. 
Tena WolverTena Wolver
Is this something SF is going to resolve?  I don't see it in the known issues.
Joe BrodarJoe Brodar
I posted a similar question about hiding those fields in the Community page on Stack Exchange, and I was able to get some help from a user over there. Bascially, to control what is shown, you have to create a Custom Component, which wasn't something I was familiar with, but the Stack Exchange user was able to help me get that figured out. 

You can check out our conversation over there: https://salesforce.stackexchange.com/questions/211385/how-do-i-create-a-custom-component-for-knowledge-in-communities

Let me know if that helps!
Joe
Carol CiceroneCarol Cicerone
Thank  you so much, Joe! Will let everyone know how it goes.
Carol CiceroneCarol Cicerone
After reading through the commuinty and stackexchange cases, our Salesforce Admin actually ended up implementing this alternative solution:

"(Worried about how displaying articles in a custom component would affect our view statistics and ability to turn on voting). I am sure all of that can be coded around, but then it would have become a much bigger undertaking. Eventually what I settled on was some CSS to hide the title and url name: 

article.content .forcePageBlockSectionRow ~ .forcePageBlockSectionRow{
    display:none;
}

This is a bit of a hack - it just hides everything but the first field in the article. So if we just use this, then articles should only have one publicly available field, which I think is okay for our purposes, but let me know if you disagree and you'd still like a custom component. We also always need page layouts to show the article body first. 

I also took the liberty of adding some more CSS to hide some things I think we don't want: 

Hide the field label ("Article Body")   
.test-id__field-label{
    display:none;
}

Hide the login/username and profile info (I am hiding the stuff inside the div because otherwise it messes with the position of the search bar) 
.cProfileCon > div{
display:none;
}

The CSS is in the theme section, Colors>Edit CSS"
 
This was selected as the best answer
Jorge PonceJorge Ponce
Hello Ohana

So I just wanted to hide the Url Name from my community, not the Title. If you add this code to your CSS in the Communtiy Builder under Themes, then select the down arrow, </> Edit CSS, it will hide the URL Name.  But the code specifically hides seciton 3 in the pagelayout  here: .slds-grid:nth-child(3). So you have to make sure your URL Name field is the third field in all your knowledge layouts exposed in your communities. 

You can use this code to hide any section in the content page layout in communities, you just have to make sure you adjust the (3) to the section you want to hide. For example, if you URL Name is the 1st field displayed, adjust the code to (1).  
div[data-region-name="content"] article.content .section__content .slds-form .slds-grid:nth-child(3) {display:none !important;}

I hope this helps

Cheers
Jorge Ponce
Patrick DufresnePatrick Dufresne

Hi Jorge,

Where would I go to add this CSS?

When I look at theme in builder doesn't seem like there is a edit script or anything simmilar to that there.

Thanks

Patrick

Jorge PonceJorge Ponce
Hello Patrick
  1. Go to the Builder
  2. Click on Theme
  3. Click on the down arrow
  4. Select "</>Edit CSS
I added my code on line 26 just because.  So you can add my code twice and change the 3 on the code to the section you want to hide.  This will hide it to all users in the community though.  I don't know how to code and make an if statement for just that profile.   I hope this helps
.slds-grid:nth-child(3)




Screen shot
Margaret MillerMargaret Miller
Has anyone successfully hidden the last published date in a community? It's not on my page layout, and I am unable to change the read/edit access for my guest community user profile. 
Jorge PonceJorge Ponce
Hello Margaret 

The only way I found was through the custom CSS code a I responded with earlier.  OOTB,  there is no solution as of yet.

Cheers
Margaret MillerMargaret Miller
Thanks, Jorge. I used the code you posted to successfully hid the Article URL section, but the Last Modified Date field is under the Summary field in what seems to be a header section, as it did not count towards the child count when using your original code. Any suggestions to hide elements in the top section below Article Title? Thanks!
Jorge PonceJorge Ponce
Hello Margaret
I'm WFH today, but I should be able to provide a solution on Monday.  If you have access to an engineer or dev, they should be able to do this when they inspect the element.  Sorry I don't have a soltuion at the moment.  Please let me know if you find one.  

Cheers

 

 
Jorge PonceJorge Ponce
Hello Margaret

I found the code!!  I also took away the image of the clock.
.selfServiceArticleHeaderDetail .date > .uiOutputDate, .selfServiceArticleHeaderDetail > .timestamp-icon, .selfServiceArticleHeaderDetail > .dot {display: none; }

Please let me know if you hava any issues.  I apologize for being late on this.  

Cheers
Margaret MillerMargaret Miller
Jorge! This is fantastic! Worked immediately with no issues. Thank you so very much!
David ShoffittDavid Shoffitt
Hi Jorge,

I am late to this party!!  I tried the code you had above to remove the URL from the article.  I had mixed results.  the info section I have in my page layout is the 2nd section.  I put in 2, but that removed my article info as well.  Any thoughts?
Soumya ReddySoumya Reddy
Hi Jorge,

I tried the code you had above to remove title and URL from article , its removing completely my article . Any thoughts what is missing here? and if we want to hide any other fields like visible to customer checkbox how do we do that ? 

 
Jorge PonceJorge Ponce
Hello Soumya

If you use code above, please make sure the Url Name field is the third field in all of your knowledge page layouts.  Since Winter '19, the check boxes seem to not be visible for clients int he community.  If you want to make them disapper, make sure you place them in the same location on all of your page layouts and add my code, but change the 3 to reflect the position of the check boxes.  
.slds-grid:nth-child(3)



User-added image

Cheers
 
Soumya ReddySoumya Reddy
Hi Jorge,

Thanks for your reply, dunno what im missing here if i use our code i m able to hide only label not able to hide the content of the title if you see below in screen shot the title is repeating. I just want to display body of article.

User-added image
 
Jorge PonceJorge Ponce
Hello Soumya

I assumed it was in the same region, but it is not.  Try this code.  It worked for me, but test it out.   This is just for the Second Title
.content .slds-form.slds-form_stacked .slds-grid.slds-gutters_small.forcePageBlockSectionRow:first-child {
    display: none;
}
Cheers
 
Ellie RinehartEllie Rinehart
Thanks so much Jorge for your help on this!

FWIW I used a combination of helps from this page in order to mimic the old ("clean") version of articles. I didn't want any of the extra text that would be confusing to a customer. I'll leave the code here in case it's helpful for anyone else. 
div[data-region-name="content"] article.content .section__content .slds-form .slds-grid:nth-child(3) {display:none !important;}
.test-id__field-label{
    display:none;
}

.content .slds-form.slds-form_stacked .slds-grid.slds-gutters_small.forcePageBlockSectionRow:first-child {
    display: none;
}

.selfServiceArticleHeaderDetail > .dot, .selfServiceArticleHeaderDetail > .article-type {display: none; }
Luiza WitkowskaLuiza Witkowska

Hi Jorge,

Thanks a lot for posting so many useful information. Much appreciated. 

I followed your steps, set the fields in the same order and implemented the code. All worked, execpt one detail - now everybody (logged and not logged in users) can see the article number on the article page. Any idea how to remove it?

User-added image

Vijayalakshmi RadhakrishnanVijayalakshmi Radhakrishnan
Hi All,
I'm very new to communities. We are using Salesforce essentials. I don't want the URL name to show up as well as Visible to Customer, Visible to Partner, Visible to Internal App and Visible in Public Knowledge Base checkboxes at the end of the article. I'm unable to clone the guest user profile or edit the FLS of the standard fields. Is coding the only way to go about it?

I would also like to know how to add members to the community? When I go to Administration -> Members, I do not see the guest profile. Any help would be greatly appreciated.

Thanks!