Hide Articles on Category page - only show Sections | Community
Skip to main content

Hide Articles on Category page - only show Sections

  • May 25, 2023
  • 8 replies
  • 0 views

Ashlei

Hello. I was wondering if there's a way to hide all the Article links on a Category page. I want to clean up my HC to only show the Sections on a Category page, so the Articles are visible only after clicking the Section page. We don't have Flexible Hierarchy. Is this possible? I would assume if possible, this change would apply to all my category pages, correct?

Thank you in advance.

8 replies

Ifra
  • May 25, 2023

Hi Ashlei Capistrano,

 

Use the below code:

.category-content .section-tree .article-list,
.category-content .section-tree .see-all-articles {display:none}

.category-content .section-tree .article-list and .category-content .section-tree .see-all-articles

both are the classess with the parent classes of articles.

 

If any query feel free to ask :)

Thanks

 

 


Ashlei
  • Author
  • June 15, 2023

Hi @ifra, sorry for the late response. Thank you for that information. I'm not exactly sure where to paste that code, and/or if it needs additional code. 


Ashlei
  • Author
  • June 16, 2023

Hi @ifra, I was able to figure out where to enter the code. The page looks as desired. Thank you. 


Ashlei
  • Author
  • June 16, 2023

Hi @ifra, is there a way to add arrows after the section titles without having to change all the section names? Also, can I reduce the space between section titles?

 


  • July 17, 2023

Hi could you share where that code goes and what it looks like?  ideally a snippet of the block that does the magic.


Ifra
  • July 23, 2023

Hi Heath Abbate,  sorry for late response, you need to add that code to your style.css file at the bottom area.

 


Joel43
  • October 19, 2023

Is there a code block anyone could share that could be used to do the same - hide articles and display sections only for 1 category? Appreciate the help! 


Ifra
  • October 20, 2023

Hey Joel,

Use this code for your query:

 if (window.location.href.indexOf("22222222222222") > -1) {
    const _artLinks = document.querySelectorAll(".article-list");
    _artLinks.forEach((e) => {
      e.style.display = "none";
    })
    }

 

Note: 22222222222222 , it's my category ID only for I want to hide articles.

 

 

Thanks