-
-
Notifications
You must be signed in to change notification settings - Fork 15
generate sitemap.xml per site and per access public #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mohamed-larbi-jebari
wants to merge
28
commits into
master-ibexa-4.5
Choose a base branch
from
sitemapxml_multisites_languages
base: master-ibexa-4.5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
bb3f0d4
generate sitemap.xml per siteAccess && inject the multilingual and mu…
mohamed-larbi-jebari b00a797
Ibexa 4.6 seo (#190)
erdnaxelaweb 7238354
generate sitemap.xml per siteAccess && inject the multilingual and mu…
mohamed-larbi-jebari 93d8588
fix: issue when () are used in metas on Ibexa 4.6
erdnaxelaweb a15adb6
fix: issue when () are used in metas on Ibexa 4.6
erdnaxelaweb 2b50789
generate sitemap.xml per siteAccess && inject the multilingual and mu…
mohamed-larbi-jebari 370ac91
fix: CS
erdnaxelaweb 37e66d3
feat: switch ddev to node 18
erdnaxelaweb 1dbee60
Add ibexa_menu.*.yml translation file
RemyNovactive d194f99
Merge pull request #196 from Novactive/ezmenumanagerbundle/ibexa-4-6/…
erdnaxelaweb 37fc577
feat: add support for siteaccess aware configuration
erdnaxelaweb 36969f0
Merge pull request #198 from Novactive/feat-SA-aware-saml-config
erdnaxelaweb 39d78d2
Add ibexa_menu.*.yml translation file
RemyNovactive cff4695
novactive/ezsolrsearchextrabundle
RemyNovactive 83f900f
Merge pull request #200 from Novactive/ezsolrsearchextrabundle/ibexa-…
erdnaxelaweb 11472ff
Merge pull request #199 from Novactive/ibexatranslationuibundle/ibexa…
erdnaxelaweb 7132731
Manage source url with site Access in UrlWildcardRouter
mohamed-larbi-jebari 2671594
fix Ibexa 4.6 version in CI as later skeleton require PHP > 8.1
erdnaxelaweb 11299ac
Merge pull request #203 from Novactive/fix-ci
erdnaxelaweb 5334fe7
fix: issue with filter tag removing `(` `)` from value
erdnaxelaweb a84773e
Merge pull request #202 from Novactive/fix-solr-filter-tag
erdnaxelaweb b4e4f94
fix: issue with redirect where source is a siteaccess with en URI match
erdnaxelaweb 1afa9d1
Merge remote-tracking branch 'origin/fix-redirect' into sitemapxml_mu…
erdnaxelaweb 9ab75f9
Merge remote-tracking branch 'origin/master' into sitemapxml_multisit…
mohamed-larbi-jebari 4ed17c2
Migration ibexa 4.6.11 && fix error $fieldTypeRegistry must not be ac…
mohamed-larbi-jebari 5e1acd1
Fix Property 'uri' not found on class Ibexa\Connector\Dam\FieldType\I…
mohamed-larbi-jebari 2b52389
Fix the format of parameters in the redirect URL
mohamed-larbi-jebari 1aab967
Fix the format of parameters in the redirect URL
mohamed-larbi-jebari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
321 changes: 256 additions & 65 deletions
321
components/SEOBundle/bundle/Controller/SitemapController.php
Large diffs are not rendered by default.
Oops, something went wrong.
173 changes: 173 additions & 0 deletions
173
components/SEOBundle/bundle/Core/Helper/SiteMapHelper.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Novactive\Bundle\eZSEOBundle\Core\Helper; | ||
|
|
||
| use Exception; | ||
| use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; | ||
| use Ibexa\Core\MVC\Symfony\Locale\LocaleConverter; | ||
| use Ibexa\Core\MVC\Symfony\Routing\Generator\RouteReferenceGenerator; | ||
| use Ibexa\Core\MVC\Symfony\Routing\UrlAliasRouter; | ||
| use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface; | ||
| use Ibexa\Migration\Log\LoggerAwareTrait; | ||
| use Psr\Log\LoggerInterface; | ||
| use Psr\Log\NullLogger; | ||
| use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | ||
| use Symfony\Component\Routing\RouterInterface; | ||
| use Throwable; | ||
|
|
||
| class SiteMapHelper | ||
| { | ||
| use LoggerAwareTrait; | ||
|
|
||
| /** | ||
| * @var ConfigResolverInterface | ||
| */ | ||
| private $configResolver; | ||
|
|
||
| /** | ||
| * @var RouteReferenceGenerator | ||
| */ | ||
| private $routeReferenceGenerator; | ||
|
|
||
| /** | ||
| * @var RouterInterface | ||
| */ | ||
| private $router; | ||
|
|
||
| /** | ||
| * @var LocaleConverter | ||
| */ | ||
| private $localeConverter; | ||
|
|
||
| /** | ||
| * @var SiteAccessServiceInterface | ||
| */ | ||
| private $siteAccessService; | ||
|
|
||
| public function __construct( | ||
| ConfigResolverInterface $configResolver, | ||
| SiteAccessServiceInterface $siteAccessService, | ||
| RouteReferenceGenerator $routeReferenceGenerator, | ||
| RouterInterface $router, | ||
| LocaleConverter $localeConverter, | ||
| ?LoggerInterface $logger = null | ||
| ) { | ||
| $this->configResolver = $configResolver; | ||
| $this->siteAccessService = $siteAccessService; | ||
| $this->routeReferenceGenerator = $routeReferenceGenerator; | ||
| $this->router = $router; | ||
| $this->localeConverter = $localeConverter; | ||
| $this->logger = $logger ?? new NullLogger(); | ||
| } | ||
|
|
||
| public function generateLocationUrl( | ||
| int $locationId, | ||
| string $siteAccess = null | ||
| ): ?string { | ||
| try { | ||
| $routeParams['locationId'] = $locationId; | ||
| $routeReference = $this->routeReferenceGenerator->generate( | ||
| UrlAliasRouter::URL_ALIAS_ROUTE_NAME, | ||
| $routeParams | ||
| ); | ||
| if ($siteAccess) { | ||
| $routeReference->set('siteaccess', $siteAccess); | ||
| } | ||
| $url = $this->router->generate( | ||
| UrlAliasRouter::URL_ALIAS_ROUTE_NAME, | ||
| $routeReference->getParams(), | ||
| UrlGeneratorInterface::ABSOLUTE_URL | ||
| ); | ||
| } catch (Throwable $exception) { | ||
| $this->logger->error('NovaeZSEO: ' . $exception->getMessage()); | ||
| $url = null; | ||
| } | ||
|
|
||
| return $url; | ||
| } | ||
| public function generateRouteUrl( | ||
| string $routeName, | ||
| string $siteAccess = null, | ||
| array $parameters = [] | ||
| ): ?string { | ||
| try { | ||
| $url = $this->router->generate( | ||
| $routeName, | ||
| [...['siteaccess' => $siteAccess], ...$parameters], | ||
| UrlGeneratorInterface::ABSOLUTE_URL | ||
| ); | ||
| } catch (Throwable $exception) { | ||
| $this->logger->error('NovaeZSEO: ' . $exception->getMessage()); | ||
| $url = null; | ||
| } | ||
|
|
||
| return $url; | ||
| } | ||
| public function getSiteAccessesLocationIdLanguages(): array | ||
| { | ||
|
|
||
| static $rootLocationLanguages = null; | ||
|
|
||
| if (is_array($rootLocationLanguages)) { | ||
| return $rootLocationLanguages; | ||
| } | ||
|
|
||
| $rootLocationLanguages = []; | ||
| $siteAccesses = $this->configResolver->getParameter('translation_siteaccesses'); | ||
| foreach ($siteAccesses as $siteAccess) { | ||
| $rootLocationLanguages[$siteAccess] = [ | ||
| 'rootLocationId' => $this->getSiteAccessRootLocationId($siteAccess), | ||
| 'mainLanguage' => $this->getSiteAccessMainLanguage($siteAccess), | ||
| 'languages' => $this->getSiteAccessLanguages($siteAccess) | ||
| ]; | ||
| } | ||
|
|
||
| return $rootLocationLanguages; | ||
| } | ||
|
|
||
| public function getCurrentSiteAccess(): ?string | ||
| { | ||
| return $this->siteAccessService->getCurrent()?->name; | ||
| } | ||
|
|
||
| public function getCurrentSiteAccessRootLocationId(): ?int | ||
| { | ||
| return $this->getSiteAccessRootLocationId($this->getCurrentSiteAccess()); | ||
| } | ||
| public function getCurrentSiteAccessMainLanguage(): ?string | ||
| { | ||
| return $this->getSiteAccessMainLanguage($this->getCurrentSiteAccess()); | ||
| } | ||
|
|
||
| public function getSiteAccessRootLocationId(string $siteAccess): ?int | ||
| { | ||
| return $this->configResolver->getParameter('content.tree_root.location_id', null, $siteAccess); | ||
| } | ||
|
|
||
| public function getSiteAccessLanguages(string $siteAccess): array | ||
| { | ||
| return (array) $this->configResolver->getParameter('languages', null, $siteAccess); | ||
| } | ||
|
|
||
| public function getSiteAccessMainLanguage(string $siteAccess): string | ||
| { | ||
| $languages = $this->configResolver->getParameter('languages', null, $siteAccess); | ||
| return array_shift($languages); | ||
| } | ||
|
|
||
| public function getHrefLang(string $languageCode): string | ||
| { | ||
| return str_replace( | ||
| '_', | ||
| '-', | ||
| ($this->localeConverter->convertToPOSIX($languageCode) ?? '') | ||
| ); | ||
| } | ||
|
|
||
| public function logException(Exception $exception): void | ||
| { | ||
| $this->logger?->error('NovaeZSEO: ' . $exception->getMessage()); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
components/SEOBundle/bundle/Resources/config/ibexa_locale_conversion.yml
|
mohamed-larbi-jebari marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #list from https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes | ||
| locale_conversion: | ||
| bre-BT: br_BT | ||
| rum-RO: ro_RO | ||
| mlt-MT: mt_MT | ||
| gle-IE: ga_IE | ||
| est-EE: et_EE | ||
| slv-SI: sl_SI | ||
| sla-MK: sl_MK | ||
| lav-LV: lv_LV | ||
| lit-LT: lt_LT | ||
| geo-GE: ka_GE | ||
| per-IR: fa_IR | ||
| bul-BG: bg_BG | ||
| bel-BY: be_BY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.