• Home
  • Get help
  • Ask a question
Last post 19 min ago
Posts last week 141
Average response time last week 4 hours 42 min
All time posts 67780
All time tickets 10474
All time avg. posts per day 21

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.

#7580 – Home multilanguage with alias in url

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Friday, 15 January 2021 08:05 UTC
Intuix

Hi, we have a problem on this site https://xxxx.com/es/ . Now the Sh404Sef is in OFF mode.  But when whe activate it, the homepage of the secondary languages  (not the default one) it change to /alias (the alias that have the home menu), for example https://xxxx.com/en/homepage and then all the urls of the rest of the page mantaint this url. For example:  https://xxxx.com/en/homepage/collections. 

Also the logo link redirect to this home alias.

We have annothers sites with sh404sef installed, with same theme and joomla version, and it works fine.

We cannot understand what's wrong with this one.

Can we help us?

Thanks.

 
Friday, 15 January 2021 08:33 UTC
wb_weeblr

Hi

The most likely reason is that you may have made associations between content showing on the home pages. That's not required with sh404SEF and may cause such issue.

Say you have article A used for ES home page and article B used for EN home page. If you go to the article list, these 2 articles should NOT have a Joomla association between them. They are already associated as being both marked as home page in each language. 

Remove the association between those articles, purge sh404SEF URLs and you should be good.

If that does not solve it, then:

- are those Joomla articles or some other content types?

- does the same happen when using one of Joomla default template and purging SEF URLs?

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Friday, 15 January 2021 09:00 UTC
Intuix

Hi Yannick

I disassociate the home articles, purged the sh404SEF urls and the issue is the same. 

I trided to change the template to default one too, purged and the issue is the same. The only change is that logo now don't link to alias hompage, but the links on homepage do it. And the sh404SEF url's detected them.

The articles are Joomla articles, not other content types.

 

 
Friday, 15 January 2021 10:08 UTC
wb_weeblr

Hi

OK, I looked again at the page and I'm not sure I understand the problem fully. Which links are your talking about?

1 - If I go to your home page, I am redirected to /es/ for instance. Then on this page, I can see the logo is linked to the home page. And then which are the links not properly working? where do you have links that go to the home page and are not correct?

2 - When we know about #1, we're going to need superadmin access to check how the link sare created in your content. I suspect the menu item id is not correct but can't be sure until I look at which content exactly you are talking about.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Monday, 18 January 2021 08:55 UTC
Intuix

Hi Yannick

Yes, it's happens only on the secondary language. He have the Spanish (es) language on default. And this one works ok, but if you change the language (contry in our case) , the logo link it starts to link to /home alias and if you click on it, it shows a 404 error. For example here (https://xxxx.com/pt).

I give you acces to admin: (it has a admin protection acces too)

https://xxxx.com/administrator/index.php?pmkls6mi

Admin protection user: xxxx
Admin protection pass: xxxx

Admin accés to Joomla:
User: xxxx
Pass: xxxx

Thanks!

 

 

 
Monday, 18 January 2021 10:16 UTC
wb_weeblr

Hi

 the logo link it starts to link to /home alias 

It actually links to the /uk/home alias.

If I search this URL in sh404SEF, it's associated with the non-sef URL: index.php?option=com_content&Itemid=101&id=185&lang=uk&view=article

Meaning it's trying to show article with id 185 (the spanish home page) under menu item id 101, which is the default, all languages menu item.

Went a bit further and looked that menu items for the the home pages, they are all associated with each others. I deleted those associations and corresponding URLs in sh404SEF but they came back the same.

So the non-sef URL provided to sh404SEF to make the SEF URL is obviously wrong, which raises the question: how is your logo created? is it a module? some custom code in your template?

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Monday, 18 January 2021 10:42 UTC
Intuix

Hi Yannick

The link of the logo is generated by the template (Yootheme Pro). But we use this template on a lot of webpages with sh404sef and this not happen

I attach you the php file of the template that paints de logo.

 

 

 
Monday, 18 January 2021 11:12 UTC
wb_weeblr

Hi

But we use this template on a lot of webpages with sh404sef and this not happen

Multilingual sites?

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Monday, 18 January 2021 11:15 UTC
Intuix

Yes, for example this one  https://www.xxxx.eu/

 

 
Monday, 18 January 2021 11:18 UTC
wb_weeblr

Hi again

I attach you the php file of the template that paints de logo.

You cannot upload PHP file, please just paste the content of the file.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 
Monday, 18 January 2021 11:20 UTC
Intuix
<?php
// Config $config->addAlias('~logo', '~theme.logo');
// Link $attrs_link = []; $attrs_link['href'] = $config('~theme.site_url'); $attrs_link['class'][] = isset($class) ? $class : ''; $attrs_link['class'][] = 'uk-logo';
// Logo $logo_el = JText::_($config('~logo.text')); $logo_img = function ($image, $width, $height, array $attrs = []) use ($config) {
$attrs['alt'] = JText::_($config('~logo.text')); $attrs['uk-gif'] = $this->isImage($image) === 'gif';
if ($this->isImage($image) === 'svg') { return $this->image($image, array_merge($attrs, compact('width', 'height'))); }
return $this->image([$image, 'thumbnail' => [$width, $height], 'srcset' => true], $attrs); };
// Logo Image if (isset($mobile)) {
if ($config('~logo.image_mobile')) { $logo_el = $logo_img($config('~logo.image_mobile'), $config('~logo.image_mobile_width'), $config('~logo.image_mobile_height')); } elseif ($config('~logo.image')) { $logo_el = $logo_img($config('~logo.image'), $config('~logo.image_width'), $config('~logo.image_height')); }
} else {
if ($config('~logo.image')) { $logo_el = $logo_img($config('~logo.image'), $config('~logo.image_width'), $config('~logo.image_height'));
// Inverse if ($config('~logo.image_inverse')) { $logo_el .= $logo_img($config('~logo.image_inverse'), $config('~logo.image_width'), $config('~logo.image_height'), ['class' => ['uk-logo-inverse']]); } }
}
?>
<?php if ($logo_el) : ?> <a<?= $this->attrs($attrs_link) ?>> <?= $logo_el ?> </a> <?php endif ?>

 
Monday, 18 January 2021 11:30 UTC
wb_weeblr

Hi

Well, does not say much, the link is taken from theme.site_url' so we would have to know how they compute this URL.

I'll do more digging with a backup and see what I can find.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Monday, 18 January 2021 11:40 UTC
Intuix

OK. Thanks. In the theme there is no input to set the site url. So it takes from Joomla.

If you canno't find the solution, i'll override this file and change the variable to "/" . I think this will work. But if we can avoid this override it will be better for further upgrades of the template.

Thanks!

 
Monday, 18 January 2021 11:48 UTC
wb_weeblr

Hi

OK. Thanks. In the theme there is no input to set the site url. 

And rightly so. The site URL is not an input. It's computed automatically based on the menu items and site langauge setup. It's not a fixed value. And the problem here is that the template is computing it wrong.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Monday, 18 January 2021 12:14 UTC
Intuix

The strange thing here is that is the same template of xxxx.eu and the same version.

By now i'll override this file and i'll use this code :

use Joomla\CMS\Uri\Uri;

$attrs_link['href'] = Uri::root();

 

If you find something else, please tell us. Thanks

 

 
Monday, 18 January 2021 12:18 UTC
wb_weeblr

Hi

Si I did not exactly find the full and complete reason, but at least found a fix:

- like I said, the template does not correctly compute the current URL. That's because it does not correctly get the current page language

- In file templates/yootheme/vendor/yootheme/theme-joomla/src/ThemeListener.php, at line 60, they are getting the menu item to use:

$itemId = ($item = $cms->getMenu()->getDefault()) ? $item->id : 0;

Working code is:

$itemId = ($item = $cms->getMenu()->getDefault($language->getTag())) ? $item->id : 0;

- However this should work as they wrote it, so there's more to it. One thing I can think of is the relative order of the system plugins for:

  - sh404SEF

  - The language filter

  - Yootheme framework

Another thing that's unusual on this site is that URL language code does not match the language code, ie URL code is uk but language is en-GB. Even more unusual is that you also have a (deleted but still in trash) language which is set to use the en URL code with language en_us.

This might be worth checking/comapring to your working site.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 

 

 

 
Monday, 18 January 2021 12:32 UTC
Intuix

Yes,  we now that changes in url codes. This site on previous version has code language "uk" for "en-GB" on "United kingdom" country and "en" for "en-US" for rest of the word (Global).  Then the client want to chang it to "uk" for global and delete the "en".   

It this can afect to this issue of the home alias?  I can delete from trash the old en_us menu. 

Can i change the order of the system plugin to match the one you wrote?

 

 
Monday, 18 January 2021 13:22 UTC
wb_weeblr

Hi

It this can afect to this issue of the home alias?  I can delete from trash the old en_us menu. 

I doubt it, what could be an issue is the url code (uk) not being part of the language code (en_gb). It should not be though, so:

- deleting the trashed item is good and should be done

- nothing else to do in that regard

Can i change the order of the system plugin to match the one you wrote?

Don't change anything. I was merely stating that comparing the working site and not-working site would be a good idea.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Tuesday, 19 January 2021 09:35 UTC
Intuix

OK.

By now, with this modification on the logo url code, the site works fine.   When i have time i'll check the ordrer of the plugins on both sites (xxxx and xxxx) to see if there is some diferences.

Thanks a lot for you attention Yannick.

 

 

 
Tuesday, 19 January 2021 10:02 UTC
wb_weeblr

Hi

You're welcome! I will leave this ticket open in case you need to add something. It will automatically close in 2 weeks if no further comment is made.

Best regards

Yannick Gaultier

weeblr.com / @weeblr

 

 
Friday, 19 February 2021 05:34 UTC
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
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.