• New Commercial Services Section

    We have now opened a commercial services section here on the forum. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.

    Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.

Add meta Property to Head from Fabrik Element?

@sunnyjey you've reached a point where I can't help on a free, ad-hoc basis. If you'd like to talk to us about a direct support arrangement, with a "bucket" of hours each month you can draw on for support, let me know.

-- hugh
 
BTW, you can also use
Code:
$metaTags  = '<title>Your page title</title>';
$metaTags .= '<meta name="description" content="'.$DescrVar.'" />';
$metaTags .= '<meta name="author" content="Your name here" />';

$mydoc = JFactory::getDocument();
$mydoc->addCustomTag($metaTags);

Instead of using php_event list plugin, I used these codes into my custom template list & with the help of Jsitemap Pro I could finally succeeded in generating dynamic metaTags based on Filters.

BUT got another big problem.

$mydoc->addCustomTag('<link rel="canonical" href="www.mydomain/canonical/url" />');

When I am trying to get canonical url by using above syntax, I get my custom canonical url.

BUT, fabrik also adds another default canonical url at the top of my custom canonical url. It is generating two URLS
  1. www.mydomain/my-menu-url (<link rel="canonical" href="/my-menu-url" /> eg. if my menu name is say hotels-listing, fabrik adds www.mydomain.com/hotels-listing/)
  2. www.mydomain/canonical/url
I guess, Fabrik is forcing Default canonical url from this file

https://github.com/Fabrik/fabrik/blob/master/components/com_fabrik/views/list/view.html.php

Code:
* Set the canonical link - this is the definitive URL that Google et all, will use
     * to determine if duplicate URLs are the same content
     *
     * @throws Exception
     */
    public function setCanonicalLink()
    {
        if (!$this->app->isAdmin() && !$this->isMambot)
        {
            $url = $this->getCanonicalLink();

            // Set a flag so that the system plugin can clear out any other canonical links.
            $this->session->set('fabrik.clearCanonical', true);
            $this->doc->addCustomTag('<link rel="canonical" href="' . htmlspecialchars($url) . '" />');
        }
    }

How do I remove the default canonical URL. Is there any way I can remove $url = $this->getCanonicalLink(); ? Is layout override for /components/com_fabrik/views/list/view.html.php possible ?

Regards & Thanks

(NB: It looks Hugh is busy somewhere in his work, as he has not yet PM me)
 
Last edited:
It works for me: just a single canonical URL when using my code in my custom list template, no further action required. I don't know Jsitemap, perhaps it is involved here, too.

However, please do a count of both opening and closing brackets in your code line. Resulting action may help.

(NB: It looks Hugh is busy somewhere in his work, as he has not yet PM me)
Use this: https://fabrikar.com/quote-request
 
Thank you once again for your reply. I have spent many hours to address this issue.

If possible can you please share your code for canonical URL.
 
Just checked, can't find or recreate the exact code without spending more time on it, it's buried in some older backups.

But, as far as I remember, and as elsewhere in J!, in Fabrik lists you'll just need to get rid of the "original" canonical URL, then add the new one. Along the lines of: get head data, loop through the relevant section, empty the value where rel="canonical" is part of the string, set head data again, then add your own tag.
 
Yes, you are right. We need to unset the default canonical first. I have uninstalled JSitemap Pro.

Even tried following code to unset canonical in default.php of my custom list template:

Code:
$doc = JFactory::getDocument();
foreach ($doc->_links as $k => $array) {
if ($array['relation'] == 'canonical') {
unset($doc->_links[$k]);
}
}

But, it is not removing the www.mydomain.com/my-menu. It looks the unset for $this->getCanonicalLink(); is not working, like other MetaTags. If possible, please test it at your testing server to confirm this issue.

Once again Thank you for your help.
 
Sorry, I'm with Hugh / @cheesegrits here:

@sunnyjey you've reached a point where I can't help on a free, ad-hoc basis. If you'd like to talk to us about a direct support arrangement, with a "bucket" of hours each month you can draw on for support, let me know.

-- hugh

So I'd say more on this and my code to follow once you have some arrangement.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top