• Home
  • Get help
  • Ask a question
Last post 25 min ago
Posts last week 81
Average response time last week 44 min
All time posts 70349
All time tickets 10858
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#9166 – Twitter image - where to set it?

Posted in ‘4SEO’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Monday, 24 October 2022 15:50 UTC
coolcatcreations

Hi Yannick,

I have a question for: https://weeblr.com/doc/products.forseo/current/configuration/social-networks/#default-sharing-image

I use Seblod on the site example.de and I want to define which Twitter Image should be used. Where can I set this up per page?

I used $document->addCustomTag and addmeta but both were overriden by the wrong 4SEO Image. Any other way to do it?

thanks
Elisa

Monday, 24 October 2022 16:09 UTC
wb_weeblr

Hi

You can manually set that in the user interface of course but if you want to do it programmatically, you should either:

- Disable 4SEO Twitter Cards generation and create them yourself as you see fit, using Joomla addCustomTags or otherwise

- Use the corresponding 4SEO filter:

In /libraries/weeblr/forseo_functions.php (create or edit), add:

<?php
/**
 * 4SEO hooks file
 *
 * You can use 2 variables to access 4SEO content:
 *
 * $factory: access variables
 * $hooks: add handlers
 */

// no direct access
defined('WBLIB_EXEC') || die;

$hooks->add( 'forseo_request_info', function ($requestInfoData) { $requestInfoData['page_custom_sharing_image'] = [ 'url' => 'httpsurl/to/your/image' ]; return $requestInfoData; } );

You can check the content of the request info array for other values you may want to modify on the fly.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 

 

 
Tuesday, 25 October 2022 11:01 UTC
coolcatcreations

Hi Yannick,

I tried now for several hours to get the addcustomtag running and seems if forseo and a plugin named System - TAGZ Open Graph are BOTH activated, joomla ignores my custom tags completely. If I disable one of both it still does not work. If I disable both my OG Tags are added.

I see what I can do further...

thanks!

Tuesday, 25 October 2022 13:06 UTC
wb_weeblr

Hi

If I disable both my OG Tags are added.

Well, first you don't to disable 4SEO entirely. You can just disable the Open Graph OR Twitter cards feature (Configuration | Social networks).

Second, yes, if Twitter card feature is enabled in 4SEO, it will output Twitter Cards. I'm sure the same for TAGZ.

joomla ignores my custom tags completely

I don't know about that. 4SEO also uses Joomla's $document->addCustomTags() to output TwitterCards or OGP data.

At which point in time are you outputting your custom tags? which event? maybe it's too late in the process?

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Tuesday, 25 October 2022 20:00 UTC
coolcatcreations

Hi Yannick, After disabling OG and Twittercards in 4SEO and uninstalling the Tagz thing it works to add the og: Data in my template override.

I cant keep 4seos og and twitter cards enabled tough because otherwise my template override is ignored. Would be good to use 4seo and have the possibility to override it in the template. But like it is now its ok.

 

Wednesday, 26 October 2022 07:52 UTC
wb_weeblr

Hi

have the possibility to override it in the template

Why would you do that in the template when we have an entire code override mechanism in place, super easy to use and that works with any template (because it's not linked to the template)?

Best

Yannick

 

 
Wednesday, 26 October 2022 11:05 UTC
coolcatcreations

Because I use custom Fields (from SEBLOD) in different combinations to generate the Data which is displayed and I find it the most easy way to say $document->addcustomtag($myvalue); I am not sure how to do it with your suggested way.

Wednesday, 26 October 2022 13:46 UTC
wb_weeblr

Hi

 I am not sure how to do it with your suggested way.

The same, there's no difference. Well, you have to do 

$document = Factory::getApplication()->getDocument();

first but then it's just Joomla code running inside of Joomla rendering process. Nothing special here.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Wednesday, 26 October 2022 13:59 UTC
coolcatcreations

I do not understand honestly - i cannot call .$cck->getValue('biblio_bild') just anywhere  for example I need to call it in the override?

Wednesday, 26 October 2022 14:10 UTC
wb_weeblr

Hi

Indeed, if using non-Joomla content, then you'd need to be able to access that. I don't know how and when Seblod defines that variable, I assume they have some way to intantiate it but if not, then you cannot use it outside of your view template override indeed.

 Would be good to use 4seo and have the possibility to override it in the template.

To be honest, I'm not sure why it does not work, ->addCustomTags() is just adding some raw tag content. We should have both at least, yours and 4SEO's.

Yannick Gaultier

weeblr.com / @weeblr

 

 
Wednesday, 26 October 2022 14:19 UTC
wb_weeblr

Hi again,

I just tested to be sure, and I have no problem adding any custom tag to the document head from the template:

- copied default.php from /components/com_content/tmpl/article/default.php to /templates/cassiopeia/html/com_content/article/default.php

- added the following to the start of the override:

Factory::getApplication()->getDocument()->addCustomTag(
        '<meta property="og:locale" content="fr_FR" class="from_template">'
);

and sure enough I get BOTH this one and the 4SEO ones, which is exactly what I would have assumed, as addCustomTag() does nothing special, does not consider duplicates, etc, it's just raw text added to the page source code.

So if your custom tags do not appear, there's more to it than just 4SEO interfering here.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Thursday, 27 October 2022 16:04 UTC
coolcatcreations

Hi Yannick, so with 4SEO Twitter and OG off it works, maybe 4 SEO is fired after the SEBLOD Content Plugin but nevermind - I got it running like that and the customer is happy. Most important thing. ;-) thank you!

Friday, 28 October 2022 07:24 UTC
wb_weeblr

Hi

 maybe 4 SEO is fired after the SEBLOD Content Plugin

That does not matter, we are not using a content pluing and alos we are just using $document->addCustomTag() so we are not removing anything from the page.

What I see when I do that, and what you should get, is that addCustomTags() works and you should have both tcards in your page source code (BTW, do you check by looking up the source code? if using an extension or Twitter debugger, they'll will likely only report the first tcards they find, not all).

I got it running like that and the customer is happy.

Yeah, but I am a "product developer", not a website developer: different way to look at things, I want to understand what's going on, not so much fix the problem right away ;)

Anyway, having SEBLOD in the picture here is too much trouble, not something I want to get involved with really. Is there or will there be a Seblod for Joomla 4?

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.