Anchor to articles in category blog layout

To make anchor-links to articles in category-blog layout, anchors need to be on the page. This is how to use a template override to get those anchors on the page.

For this we need a template override. It might be that the template you are using already got a template override for category-blog-items. So check first if you got this file in your template:

  1. Check if you got this file:
    templates/template_name/html/com_content/category/blog_item.php
    If you got this file, go to 3, else read on at 2.
  2. Copy this file:
    components/com_content/views/category/tmpl/blog_item.php
    to
    templates/template_name/html/com_content/category/
  3. Open
    templates/template_name/html/com_content/category/blog_item.php
  4. Find this code around line 18:
    JHtml::core();
  5. replace that code with:
    JHtml::core();
    echo '<a id="item'.$this->item->id.'"></a>';
  6. done.

 
Follow Us On Twitter