Hide Related Articles when there are none

The Related Articles section will display regardless of how many articles are in it.

Some authors prefer to hide this section when it's empty.

To do so:

  1. Go to Customize > Style (HTML & CSS).
  2. In the Customize HTML, CSS, and JS section, select Custom HTML.
  3. Click on the Custom HTML tab.
  4. Select Article from the Select HTML section to edit dropdown.
  5. Copy the code below and paste it into the bottom of the Article Custom HTML pane:
    <script>
      //If Related Articles section at bottom of the article has no related articles, hide the section
      $(function() {
        if( $('.ko-related-articles ul li:eq(0)').text().trim() == "None" )  
          $('.ko-related-articles').hide();
      });
    </script>
  6. Be sure to Save your changes.