• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WriteNowDesign - Wordpress and Ecommerce Website Design

WordPress, Joomla, Ecommerce Website Design

  • Home
  • Prices/Packages
  • WordPress
  • Services
  • Portfolio
  • Blog
  • About
    • Testimonials
    • Locations
    • Online Payment
  • Contact
  • Show Search
Hide Search

Call 303-907-6133 Email

Add Canonical URL Link to Joomla Home Page

August 10, 2012 by Pat Fortino

Currently, there are no extensions for Joomla that add a canonical link to your pages. However, you can easily add that link to your home page.

To add a canonical link to your Joomla home page

Note: This procedure requires that you edit your Joomla template.

  1. Download the template file that contains the html <head> information and open it with a text editor. The main template file is usually in /templates/your-template/index.php. However, if you are using a Joomla template framework such as Yootheme Warp or RocketTheme Gantry, you need read the documentation for editing framework files.For YooTheme Warp, you can find the file in /templates/yoo-template/template.phpNote: If you modify a core framework file, your changes will be overwritten if you install a framework or template update. With YooTheme Warp, you can create your own style and copy the template file there. See Warp documentation for details.
  2. Somewhere between the opening and closing <head> tag, add the following code:
    <?php $app = JFactory::getApplication();
    $menu = $app->getMenu();
    if ($menu->getActive() == $menu->getDefault()) { ?>
    <link rel="canonical" href="http://mysite.com" />
    <?php } ?>

    Note: this code tells Joomla to determine if the page displayed is the home page. If it is, then it inserts the canonical link. If it’s not the home page, then no canonical link gets displayed.

    Pages: Page 1 Page 2

Tagged With: Joomla, Search Engine Optimization, Comments are closed. If you have information to share, contact me here.

Previous Post: « Joomla Redirect index.php Home Page to Site Root
Next Post: Safari Reading List Bookmark Sync iCloud »

Reader Interactions

Comments

  1. Jordan D. says

    December 21, 2012 at 7:44 am

    @Pat Fortino “Currently, there are no extensions for Joomla that add a canonical link to your pages”

    This isn’t true. I’ve been using a canonicalization app on all of my Joomla 2.5 sites for at least the last year. Further, a quick Google search returns two different extensions, at least.

    This one has 4.94/5.0
    http://extensions.joomla.org/extensions/site-management/seo-a-metadata/url-canonicalization-/5355

    Here’s another one for multi-language sites:
    http://extensions.joomla.org/extensions/site-management/seo-a-metadata/url-canonicalization-/19802

    • Pat Fortino says

      December 21, 2012 at 7:49 am

      I’m not talking about domain name canonization. I’m talking about the canonical url that needs to be written on each unique page so you can avoid duplicate content. There are no joomla extensions that do this.

      • Jordan D. says

        December 21, 2012 at 4:52 pm

        I don’t know man… There’s a category of extension called “URL Canonicalization.”

        index.php?option=com_content&view=article&id=199:dispatch-monitor-and-report&catid=64:field-service-management&Itemid=498

        I spot checked one of the sites I run, http://www.morphisinc.com, by clicking on random links in the top menu and then viewing the page source. All of them had rel=canonical with the appropriate URL.

        What I wasn’t able to find was a non-canonical version of a page that didn’t redirect to a canonical version, but I thought about it and I didn’t see how the extension would accomplish this given the information it was given. I suspect that it just puts the tag on every page which kind of janky.

        I like your fix though. Do you know of any reason why one wouldn’t be able to make an extension based on this fix?

        • Pat Fortino says

          December 24, 2012 at 6:57 am

          I think you can use a sef extension like sh404sef to write cannonical urls for each page, but there are no extensions that do it automatically. Having to write each one manually would be a major pain if you have 100s of pages.

  2. Andy says

    January 5, 2013 at 12:01 pm

    Ich habe unter http://stackoverflow.com/questions/14147627/get-active-menu-url/14171745? eine Frage nach einer ein wenig erweiterten Version eröffnet. Eventuell hat hier jemand eine Idee?

  3. calvin says

    January 18, 2013 at 4:11 am

    I dont want this on just my home page – your solution only works for that.

    If a age is internal say site.com/page1

    then I would like the code to be
    canonurl=site.com/section1/page1

    even if the page is found by inserting ignored junk (like crawling seems able to do)

    site.com/I-am-ignored-junk/section1/page1

    I still want the same canon url to be displayed as

    !!!!!!! canonurl=site.com/section1/page1 !!!!!!!

    , but what is the joomla framework php that will give me the right URL !

Related

Primary Sidebar

Blog Categories

Call Today

Get a Free Quote

303-907-6133

Subscribe to News

News about WordPress, WooCommerce, & Technology

What’s New

  • WPForms Not Sending Notifications
  • Add Terms and Conditions WooCommerce
  • Fix WordPress AMP Validation Errors
  • Use the Classic Editor with Gutenberg Block Editor
  • Add a Message at Top or Bottom of WooCommerce Checkout Page
  • How to Link to a PDF in WordPress

Find Us On…

  • Facebook
  • LinkedIn
  • RSS

Call 303-907-6133 Email

© 2004–2022 · WriteNowDesign · Sitemap · Log in · Return to Top