Show/Hide Section on Blog Page

Description

  • show/hide section to have custom section on each blog category page
  • view demo – password: abc (click on each category to view result)
  • buy me a coffee

07.26c11v10 Show Hide Section on Blog Page

#1. Install Code

#1.1. First, create some Pages in Not Linked to host these custom sections

URL: /blog-category-custom-content-seo

07.26c11v10 Show Hide Section on Blog Page

URL: /blog-category-custom-content-digital-marketing

07.26c11v10 Show Hide Section on Blog Page

URL: /blog-category-custom-content-ai-optimization

07.26c11v10 Show Hide Section on Blog Page

#1.2. Add your desired section to these pages

Like this

07.26c11v10 Show Hide Section on Blog Page

Like this

07.26c11v10 Show Hide Section on Blog Page

#1.3. Click Gear icon on Blog Page

06.26c29v9 Blog Post Print Text

#1.4. Click Advanced > Post Blog Item Code Injection

06.26c29v9 Blog Post Print Text

#1.5. Paste this code

  • If your site is Personal/Basic Plan and it doesn’t support Injection, see #3.1
<!-- 07.26c11v10 Show/Hide Section on Blog Page -->
<script>
window.BlogCategoryContentConfig = {
  categoryPages: {
    "SEO": "/blog-category-custom-content-seo",
    "Digital Marketing": "/blog-category-custom-content-digital-marketing",
    "AI Optimization": "/blog-category-custom-content-ai-optimization"
  },
  sourceSelector: "#sections",
  minHeight: "unset",
  skipInEditMode: true,
  maxWait: 10000,
  pollInterval: 200
};
</script>
<script src="https://code.beaverhero.com/blogpost/0726c11v10showhidesection.js"></script>

07.26c11v10 Show Hide Section on Blog Page

#1.6. Remember to update Category Name – URL you added in #1.1

categoryPages: {
   "SEO": "/blog-category-custom-content-seo",
   "Digital Marketing": "/blog-category-custom-content-digital-marketing",
   "AI Optimization": "/blog-category-custom-content-ai-optimization"
 },

#2. Customize

nothing now

#3. Other

#3.1. If you use Personal/Basic Plan and your plan doesn’t support Injection, you can edit Site Footer

05.26c08v1 Event Default Location

Add a Markdown Block

04.26c10v2 Header Sound Icon

Add this code into Markdown

<script>
window.BlogCategoryContentConfig = {
  categoryPages: {
    "SEO": "/blog-category-custom-content-seo",
    "Digital Marketing": "/blog-category-custom-content-digital-marketing",
    "AI Optimization": "/blog-category-custom-content-ai-optimization"
  },
  sourceSelector: "#sections",
  minHeight: "unset",
  skipInEditMode: true,
  maxWait: 10000,
  pollInterval: 200
};
</script>
<script src="https://code.beaverhero.com/blogpost/0726c11v10showhidesection.js"></script>

07.26c11v10 Show Hide Section on Blog Page

Buy me a coffee