Ext: sg_seo

License: GNU GPL, Version 2

Repository: https://gitlab.sgalinski.de/typo3/sg_seo

Please report bugs here: https://gitlab.sgalinski.de/typo3/sg_seo

About

This extension provides a Google sitemap implementation with additional features like:

  • ignoring pages with canonical links to other pages
  • respecting noindex & nofollow options
  • ignoring shortcuts and status pages

Scheduler

There are two scheduler tasks for this extension

  1. A scheduler task to generate a sitemap for each language
  2. A scheduler task to generate webp versions of the processed files

Sitemap generation

This scheduler task can be activated to create static sitemaps of each language, which then can be delivered instead of a dynamic process which could take a long time.

The task takes 3 arguments:

  1. relativePathToSitemap: Describes where to save the generated sitemap files in the file system. This defaults to the project root.
  2. siteRootId: The id of the site root, where the sitemap will start
  3. enableFilter: Switch to add hidden pages (does not affect "NOT_IN_MENU") to the sitemap

WebP generation

This scheduler task can generate webp versions of the images in processed folders. It uses the PHP builtin function imagewebp and thus relies on the gd-extension to be installed (default requirement of TYPO3).

The task takes 5 arguments:

  1. storageUid: The uid of the file storage to process. Defaults to 1 which usually is the fileadmin
  2. savingPercentage: Define the minimum percentage of filesize savings the process has to achieve. By default, it is set to 10
  3. imageQuality: Define the image quality. This is set to 80 by default.
  4. batchSize: The number of files to process in one go (Note: The task will not stop after the amount of files, but fetch the amount of files, then process them before fetching the next batch. If it crashes, the task can be executed again, and it will continue with the batch it last worked on.) Defaults to 500.
  5. processGif: Include gif images in the processing, defaults to 0, which means no

Apache .htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{DOCUMENT_ROOT}/$1.$2.webp -f
    RewriteRule ^(fileadmin/.+)\.(png|jpe?g)$ $1.$2.webp [L]
</IfModule>

<IfModule mod_headers.c>
    Header append Vary Accept env=REDIRECT_accept
</IfModule>

AddType image/webp .webp

nginx

Add a map directive in your global nginx configuration:

map $http_accept $webp_suffix {
    default   "";
    "~*webp"  ".webp";
}

and add these rules to your server configuration:

location ~* ^/fileadmin/.+\.(png|jpg|jpeg)$ {
        add_header Vary Accept;
        try_files $uri$webp_suffix $uri =404;
}
location ~* ^/other-storage/.+\.(png|jpg|jpeg)$ {
        add_header Vary Accept;
        try_files $uri$webp_suffix $uri =404;
}

Make sure that there are no other rules that already apply to the specified image formats and prevent further execution!

Extensions - SeoAccessPageListEventListener

You can hook into the process to extend the sitemap easily.

Example: Services.yaml

services:
    MyExt\Event\Listener\SeoAccessPageListEventListener:
        tags:
            -   name: event.listener
                identifier: 'accessPageListEvent'
                event: SGalinski\SgSeo\Events\AccessPageListEvent

EventListener class:

class SeoAccessPageListEventListener {
    public function __invoke(\SGalinski\SgSeo\Events\AccessPageListEvent $event) {
        $pageList = $event->getPageList();
        // ... do something with the list and write it back to the event
        $pageList[] = [
            'url' => 'MY FURTHER URL',
            'title' => ''
        ];
        $event->setPageList($pageList);
    }
}

More Events

Additionally there are new Events with sg_seo 5.3:

OverrideSitemapRendererEvent

allows to set a different Renderer for the final output

ShouldIncludePageInSitemapEvent

given an array of $pageInfo and a $language, you can decide not to use a page in normal pageRendering

Extensions - XmlSitemapDataProviders

We also support the official XmlSitemapDataProviders API of TYPO3. You can see more here https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/XmlSitemap/Index.html .

When we generate the sitemap, we generate every sitemap type to a new index. The default xmlSitemap type is being merged into our sitemap.xml. Please bear in mind, that we ignore any additional data providers for the pages unique key, as this is the default TYPO3 unique key and we don't want any duplicates. Use another unique key for your extension.

The other sitemap types are generated into their own respective sitemap indices.

Example (News extension):

plugin.tx_seo {
    config {
        xmlSitemap { // new entries to the default sitemap.xml
            sitemaps {
                news {
                    provider = GeorgRinger\News\Seo\NewsXmlSitemapDataProvider
                    config {
                        ...
                    }
                }
            }
        }
        googleNewsSitemap { // a completely new googlenewssitemap.xml
            sitemaps {
                news {
                    provider = GeorgRinger\News\Seo\NewsXmlSitemapDataProvider
                    config {
                        googleNews = 1
                        ...
                        template = GoogleNewsXmlSitemap.html
                    }
                }
            }
        }
    }
}

This example will result into the news unique key data provider entries being added into the default sitemap (xmlSitemap). The googleNewsSitemap entry will fetch the entries from this dataprovider and create a brand new sitemap index.

Changing the values of your tags like , <description> etc.</h2> <p>Overrinding the values of <title> etc. is not trivial, as TYPO3's PageRenderer is sometimes called after caching the HTML output for output for the <head>. For this purpose we introduced the HeadTagService that you can call in your Controllers. It comes handy when you have plugins with database driven models and you want their metadata to be used for the page metadata. Check out this example with jobs:</p> <pre><code>$headTagService = GeneralUtility::makeInstance( HeadTagService::class, TRUE, $job->getTitle(), $job->getDescription(), '&tx_sgjobs_jobapplication[jobId]=' . $jobId ); $headTagService->execute(); </code></pre> <p>The 2nd parameter is very important - TRUE/FALSE describes whether the ControllerAction from which you are calling is cachable or not. This way the service decides what is the proper way to override the values of the next arguments:</p> <ul> <li>title</li> <li>description</li> <li>GET arguments that must be appended to the router for the generation of the canonical and hreflang tags</li> </ul> </div> </div> <!--TYPO3SEARCH_end--> </main> <a href="#top" title="Zurück nach oben" class="m-to-top"> <span class="sr-only"> Zurück nach oben </span> </a> <div class="cookie-alert closed" id="cookie-alert"> <div class="container"> <div class="row"> <div class="col-sm-11"> </div> <div class="col-sm-1"> <a href="#" class="btn btn-warning btn-md">OK</a> </div> </div> </div> </div> <footer class="footer"> <div class="container"> <div id="c1222" class="row default-content-element frame frame-default frame-type-gridelements_pi1 frame-layout-0 " data-colcount="3"> <div class="col-md-6 col-xs-6 col-xxs-12 "> <div id="c13020" class="default-content-element"> <div class="ce-textpic ce-left ce-above"> <div class="ce-bodytext"> <p><span class="lead">Sitemap</span></p><ul class="default-list"> <li><a href="/">Digitalagentur für TYPO3, Individualsoftware, Mobile Apps & Shopware</a></li> <li><a href="/typo3-agentur/">Die TYPO3-Agentur aus München</a></li> <li><a href="/shopware-agentur/">Die Agentur für Online-Shops mit Shopware aus München</a></li> <li><a href="/mobile-app-agentur/">Agentur für mobile Android- und iOS-Apps aus München</a></li> <li><a href="/individualsoftware-symfony-agentur/">Symfony Agentur aus München – Entwicklung Individueller Software </a></li> <li><a href="/typo3-produkte-webentwicklung/">Web Development Produkte für TYPO3 und Intellij IDEs</a></li> <li><a href="/unternehmen/">Die Digitalagentur aus München</a></li> </ul><p>Produkte</p><ul class="default-list"> <li><a href="/typo3-produkte-webentwicklung/typo3-fluid-phpstorm-intellij/">Das Fluid-Plugin für IntelliJ IDEs wie PhpStorm</a></li> <li><a href="/typo3-produkte-webentwicklung/typoscript-phpstorm-webstorm-intellij/">Das TypoScript-Plugin für IntelliJ IDEs wie PhpStorm</a></li> <li><a href="/typo3-produkte-webentwicklung/sgalinski-cookie-optin/">DSGVO & ePrivacy Cookie Consent Extension für TYPO3</a></li> <li><a href="/typo3-produkte-webentwicklung/seo-redirects/">SEO-Weiterleitungen und Error 404 Handling via TYPO3-Extension</a></li> <li><a href="/typo3-produkte-webentwicklung/youtube-und-vimeo-videos-in-typo3-seiten-einbinden/">TYPO3 Video-Extensions für YouTube & Vimeo</a></li> </ul><p>Aus dem Expert Topics Blog</p><ul class="default-list"> <li><a href="/typo3-agentur/technik/2022-07-18-umstieg-auf-typo3-v11-lts-warum-sich-ein-typo3-upgrade-lohnt/">Umstieg auf TYPO3 v11 LTS – Warum sich ein TYPO3 Upgrade lohnt</a></li> <li><a href="/typo3-agentur/technik/maximieren-sie-ihre-content-erfolge-mit-chatgpt-und-typo3-alles-was-sie-wissen-muessen/">Effiziente Content-Erstellung mit der AI ChatGPT und TYPO3: Ein Leitfaden</a></li> <li><a href="/typo3-agentur/technik/how-to-create-a-basic-rest-api-in-symfony/">How to create a basic REST API in Symfony?</a></li> <li><a href="/typo3-agentur/technik/how-to-work-with-doctrine-migrations-in-symfony/">How to work with Doctrine Migrations in Symfony?</a></li> </ul> </div> </div> </div> <div id="c15082" class="default-content-element"><article class="default-content-element sgjobs-job-offers-teaser"><h4><span class="sgjobs-job-offers-teaser-number"> 4 </span> Offene Stellenangebote </h4><ul class="sgjobs-job-offers-teaser-list"><li><a href="/unternehmen/jobs/bewerbung/bewerbung/frontend-developer-m-w-d-2023/"> Frontend Web Developer (m/w/d) </a></li><li><a href="/unternehmen/jobs/bewerbung/bewerbung/werkstudent-web-developer-m-w-d-2023/"> Werkstudent:in Web-Development (m/w/d) </a></li><li><a href="/unternehmen/jobs/bewerbung/bewerbung/web-development-typo3-m-w-d-2023/"> Web-Development TYPO3 (m/w/d) </a></li><li><a href="/unternehmen/jobs/bewerbung/bewerbung/web-development-symfony-m-w-d-2023/"> Web-Development Symfony (m/w/d) </a></li></ul><a href="/unternehmen/jobs/" class="cta-link sgjobs-job-offers-teaser-more"> Alle offenen Stellen </a></article></div> </div> <div class="col-md-3 col-xs-6 col-xxs-12 "> <div id="c1225" class="default-content-element"> <div class="ce-textpic ce-left ce-above"> <div class="ce-bodytext"> <p><span class="lead">Technologie-Partner von</span></p> </div> </div> </div> <div id="c1540" class="default-content-element"> <div class="ce-textpic ce-center ce-above"> <div class="ce-gallery" data-ce-columns="1" data-ce-images="1"> <div class="ce-outer"> <div class="ce-inner"> <div class="ce-row"> <div class="ce-column"> <figure class="image"> <a href="https://typo3.org/project/association" target="_blank" rel="noreferrer"> <picture><img class="image-embed-item " width="210" height="105" alt="TYPO3 Gold Membership" src="https://cdn.sgalinski.de/fileadmin/media/footer/typo3-gold-membership.svg" loading="lazy" /></picture> </a> </figure> </div> </div> </div> </div> </div> </div> </div> <div id="c13603" class="row default-content-element frame frame-default frame-type-gridelements_pi1 frame-layout-0 " data-colcount="2"> <div class="col-md-6 col-sm-6 col-xs-12 "> <div id="c13604" class="default-content-element"> <div class="ce-textpic ce-left ce-above"> <div class="ce-gallery" data-ce-columns="1" data-ce-images="1"> <div class="ce-row"> <div class="ce-column"> <figure class="image"> <a href="https://typo3.org/project/technology-supporters/" target="_blank" rel="noreferrer"> <picture><img class="image-embed-item " width="115" height="151" alt="Technology Supporter of TYPO3" src="https://cdn.sgalinski.de/fileadmin/media/footer/Typo3Supporter4.svg" loading="lazy" /></picture> </a> </figure> </div> </div> </div> </div> </div> </div> <div class="col-md-6 col-sm-6 col-xs-12 "> <div id="c13605" class="default-content-element"> <div class="ce-textpic ce-left ce-above"> <div class="ce-gallery" data-ce-columns="1" data-ce-images="1"> <div class="ce-row"> <div class="ce-column"> <figure class="image"> <a href="https://www.typo3-solr.com/sponsors/our-sponsors/" target="_blank" rel="noreferrer"> <picture><img class="image-embed-item " width="170" height="235" alt="Solr für TYPO3 Partner" src="https://cdn.sgalinski.de/fileadmin/media/footer/badges-solr_fuer_typo3_2020.svg" loading="lazy" /></picture> </a> </figure> </div> </div> </div> </div> </div> </div> </div> <div id="c12968" class="default-content-element"> <div class="ce-textpic ce-left ce-below"> <div class="ce-bodytext"> <p><span class="lead">Wir sind zertifiziert</span></p> </div> <div class="ce-gallery" data-ce-columns="1" data-ce-images="1"> <div class="ce-row"> <div class="ce-column"> <figure class="image"> <a href="https://de.ryte.com/" target="_blank" rel="noreferrer"> <picture><source media="(max-width: 480px)" srcset="https://cdn.sgalinski.de/fileadmin/_processed_/4/d/csm_ryte_expert_badge_e4cab5f9e9.webp" /> <img class="image-embed-item image-no-svg" width="838" height="283" alt="RYTE Expert Badge" src="https://cdn.sgalinski.de/fileadmin/_processed_/4/d/csm_ryte_expert_badge_27344fa821.webp" loading="lazy" /></picture> </a> </figure> </div> </div> </div> </div> </div> </div> <div class="col-md-3 col-xs-6 col-xxs-12 "> <div id="c1541" class="default-content-element"> <div class="ce-textpic ce-left ce-above"> <div class="ce-bodytext"> <p><span class="lead">Kontakt</span></p> <p> <a href="tel:004936076209504">+49 (0) 36076 209504</a><br> <a href="tel:004915121240734"> +49 (0) 151 21240734</a><br> <a href="#" data-mailto-token="hvdgoj5npkkjmoVnbvgdinfd9yz" data-mailto-vector="-5"> support@sgalinski.de</a><br> <a href="skype:stefangalinski?add"> stefangalinski</a><br> <br> <strong>sgalinski Internet Services</strong><br> Inhaber: Stefan Galinski<br> Bahnhofstr. Gernrode 52<br> 37339 Gernrode</p> </div> </div> </div> <div id="c15101" class="default-content-element"><p class="lead"><a href="https://twitter.com/sgalinski" target="_blank" rel="noopener"><span class="fa fa-twitter-square"></span></a> <a href="https://www.youtube.com/c/SgalinskiDeInternetServices" target="_blank" rel="noopener"><span class="fa fa-youtube-square"></span></a> <a href="https://www.xing.com/pages/sgalinskiinternetservices" target="_blank" rel="noopener"><span class="fa fa-xing-square"></span></a> <a href="https://www.facebook.com/sgalinskiAgency" target="_blank" rel="noopener"><span class="fa fa-facebook-square"></span></a> <a href="https://www.linkedin.com/company/sgalinski-internet-services" target="_blank" rel="noopener"><span class="fa fa-linkedin-square"></span></a></p><p><a href="https://cdn.sgalinski.de/news.xml" target="_blank" rel="noopener"><span class="fa fa-rss"></span> News-Feed</a></p><p><a href="/impressum/"><span class="fa fa-external-link-square"></span> Impressum</a><br /><a href="/datenschutz/"><span class="fa fa-external-link-square"></span> Datenschutz</a><br /><a href="/html-sitemap/"><span class="fa fa-external-link-square"></span> Sitemap</a></p><p><a href="/unternehmen/kontakt/"><span class="fa fa-envelope"></span> Kontakt</a></p></div> </div> </div> </div> <div class="copyright-footer"> <div class="container"> © sgalinski Internet Services. Implementierung durch die TYPO3 Agentur <a href="https://www.sgalinski.de/" target="_blank" title="Your TYPO3 agency in Unterföhring">sgalinski Internet Services</a> </div> </div> </footer> </div> <div class="contact-information-layer" id="contact-information-layer"> <div class="gcontainer"> <button title="Close (Esc)" type="button" class="gclose gbtn"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"></path></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"></path></g></g></svg> </button> </div> <div class="contact-information-layer-container"> Sie haben Fragen? <br/> Kontaktieren Sie uns! <ul class="contact-information-layer-list"> <li> <a href="mailto:support@sgalinski.de"><i class="fa fa-envelope-o" aria-hidden="true"></i> support@sgalinski.de</a> </li> <li> <a href="tel:+4936076209504"><i class="fa fa-phone ml-1" aria-hidden="true"></i> +49 (0) 36076 209504</a> </li> <li> <a href="tel:+4915121240734"><i class="fa fa-whatsapp ml-1" aria-hidden="true"></i> +49 (0) 151 21240734</a> </li> </ul> </div> </div> </body> </html>