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="Back to top" class="m-to-top"> <span class="sr-only"> Back to top </span> </a> <footer class="footer"> <div class="container"> <div class="popup popup--closed" id="c29703" data-enable-exit-intent="1" data-save-link-closing-time="0" data-time="0" data-time-after-close="0" data-scroll-depth="0"> <div class="popup__content"> <div class="container popup__inner-content-wrapper"> <div class="popup__top-content"> <div class="popup__close-container btn btn-default"><span class="popup__close"></span></div> <div id="c29707" 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"> <picture><img class="image-embed-item " width="39" height="53" alt="" src="/fileadmin/user_upload/droplet-solid.svg" loading="lazy" /></picture> </figure> </div> </div> </div> </div> </div> <div class="ce-bodytext"> <h3 class="h3 text-center"><strong>You still have open questions?</strong></h3> </div> </div> </div> </div> <div id="c29706" class="default-content-element"> <div class="ce-textpic ce-center ce-above"> <div class="ce-bodytext"> <p class="lead text-center"><strong><span class="text-primary">Free initial consultation!</span></strong></p> <p class="text-center"><a href="tel:+4915121240734" class="btn-block btn-lg btn-primary">Call now</a></p> <p class="text-center"><a href="https://www.sgalinski.de/en/company/contact/" target="_blank" class="btn-block btn-lg btn-primary">To the contact form</a></p> </div> </div> </div> </div> </div> </div> <div id="c1222" class="default-content-element frame frame-default frame-type-gridelements_pi1 frame-layout-0 "> <div class="row default-content-element " 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="/en/">Digital Agency for TYPO3, Custom Software, Mobile Apps & Shopware </a></li> <li><a href="/en/typo3-agency/">The TYPO3 agency from Munich</a></li> <li><a href="/en/shopware-agency/">The agency for online shops with Shopware from Munich</a></li> <li><a href="/en/mobile-app-agency/">Agency for mobile Android and iOS apps from Munich</a></li> <li><a href="/en/custom-software-symfony-agency/">Symfony Agency from Munich – Custom Software Development</a></li> <li><a href="/en/typo3-products-web-development/">Web development Products for TYPO3 and Intellij IDEs</a></li> <li><a href="/en/company/">The Digital Agency from Munich</a></li> </ul><p>Products</p><ul class="default-list"> <li><a href="/en/typo3-products-web-development/typo3-fluid-phpstorm-intellij/">The Fluid plug-in for IntelliJ IDEs like PhpStorm</a></li> <li><a href="/en/typo3-products-web-development/typoscript-phpstorm-webstorm-intellij/">The TypoScript plug-in for IntelliJ IDEs like PhpStorm</a></li> <li><a href="/en/typo3-products-web-development/cookie-optin-for-typo3/">DSGVO & ePrivacy Cookie Consent Extension for TYPO3</a></li> <li><a href="/en/typo3-products-web-development/seo-redirects/">SEO Redirects and Error 404 Handling via TYPO3-Extension</a></li> <li><a href="/en/typo3-products-web-development/embed-youtube-and-vimeo-videos-into-typo3-pages/">TYPO3 Video Extensions for YouTube & Vimeo</a></li> </ul><p>From our expert topics blog</p><ul class="default-list"> <li><a href="/en/typo3-agency/technology/top-2022-07-18-upgrade-to-typo3-v11-lts-why-a-typo3-upgrade-is-worthwhile/">Upgrade to TYPO3 v11 LTS – Why a TYPO3 upgrade is worthwhile</a></li> <li><a href="/en/typo3-agency/technology/2023-02-14-efficient-content-creation-with-ai-chatgpt-and-typo3-a-guide/">Efficient Content Creation with AI ChatGPT and TYPO3: A Guide</a></li> <li><a href="/en/typo3-agency/technology/how-to-create-a-basic-rest-api-in-symfony/">How to create a basic REST API in Symfony?</a></li> <li><a href="/en/typo3-agency/technology/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"><a id="c24454" class="ce-id-anchor"></a><article class="default-content-element sgjobs-job-offers-teaser"><h4><span class="sgjobs-job-offers-teaser-number"> 4 </span> Open vacancies </h4><ul class="sgjobs-job-offers-teaser-list"><li><a href="/en/company/jobs/application/apply/frontend-engineer-m-f-d-2023/"> Frontend Engineer (m/f/d) </a></li><li><a href="/en/company/jobs/application/apply/web-developer-typo3-m-f-d-2023/"> Web Developer TYPO3 (m/f/d) </a></li><li><a href="/en/company/jobs/application/apply/working-student-web-developer-m-f-d-2023/"> Working Student Web Development (m/f/d) </a></li><li><a href="/en/company/jobs/application/apply/web-developer-symfony-m-f-d-2/"> Web Developer Symfony (m/f/d) </a></li></ul><a href="/en/company/jobs/" class="cta-link sgjobs-job-offers-teaser-more"> All vacancies </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">Technology partner of</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="/fileadmin/media/footer/typo3-gold-membership.svg" loading="lazy" /></picture> </a> </figure> </div> </div> </div> </div> </div> </div> </div> <div id="c13603" class="default-content-element frame frame-default frame-type-gridelements_pi1 frame-layout-0 "> <div class="row default-content-element " 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="/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 for TYPO3 partner" src="/fileadmin/media/footer/badges-solr_fuer_typo3_2020.svg" loading="lazy" /></picture> </a> </figure> </div> </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">We are certified</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="/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="/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">Contact</span></p> </div> </div> </div> <div id="c29759" class="default-content-element"><a id="c29760" class="ce-id-anchor"></a><p><a href="tel:004936076209504"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm90.7 96.7c9.7-2.6 19.9 2.3 23.7 11.6l20 48c3.4 8.2 1 17.6-5.8 23.2L168 231.7c16.6 35.2 45.1 63.7 80.3 80.3l20.2-24.7c5.6-6.8 15-9.2 23.2-5.8l48 20c9.3 3.9 14.2 14 11.6 23.7l-12 44C336.9 378 329 384 320 384C196.3 384 96 283.7 96 160c0-9 6-16.9 14.7-19.3l44-12z"/></svg>  +49 (0) 36076 209504 </a><br/><a href="tel:004915121240734"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 384 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M16 64C16 28.7 44.7 0 80 0H304c35.3 0 64 28.7 64 64V448c0 35.3-28.7 64-64 64H80c-35.3 0-64-28.7-64-64V64zM224 448a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM304 64H80V384H304V64z"/></svg>  +49 (0) 151 21240734 </a><br/><a href="mailto:support@sgalinski.de"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M64 112c-8.8 0-16 7.2-16 16v22.1L220.5 291.7c20.7 17 50.4 17 71.1 0L464 150.1V128c0-8.8-7.2-16-16-16H64zM48 212.2V384c0 8.8 7.2 16 16 16H448c8.8 0 16-7.2 16-16V212.2L322 328.8c-38.4 31.5-93.7 31.5-132 0L48 212.2zM0 128C0 92.7 28.7 64 64 64H448c35.3 0 64 28.7 64 64V384c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V128z"/></svg>  support@sgalinski.de </a><br/><a href="skype:stefangalinski?add"><svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M424.7 299.8c2.9-14 4.7-28.9 4.7-43.8 0-113.5-91.9-205.3-205.3-205.3-14.9 0-29.7 1.7-43.8 4.7C161.3 40.7 137.7 32 112 32 50.2 32 0 82.2 0 144c0 25.7 8.7 49.3 23.3 68.2-2.9 14-4.7 28.9-4.7 43.8 0 113.5 91.9 205.3 205.3 205.3 14.9 0 29.7-1.7 43.8-4.7 19 14.6 42.6 23.3 68.2 23.3 61.8 0 112-50.2 112-112 .1-25.6-8.6-49.2-23.2-68.1zm-194.6 91.5c-65.6 0-120.5-29.2-120.5-65 0-16 9-30.6 29.5-30.6 31.2 0 34.1 44.9 88.1 44.9 25.7 0 42.3-11.4 42.3-26.3 0-18.7-16-21.6-42-28-62.5-15.4-117.8-22-117.8-87.2 0-59.2 58.6-81.1 109.1-81.1 55.1 0 110.8 21.9 110.8 55.4 0 16.9-11.4 31.8-30.3 31.8-28.3 0-29.2-33.5-75-33.5-25.7 0-42 7-42 22.5 0 19.8 20.8 21.8 69.1 33 41.4 9.3 90.7 26.8 90.7 77.6 0 59.1-57.1 86.5-112 86.5z"/></svg>  stefangalinski </a></p></div> <div id="c29761" class="default-content-element"> <div class="ce-textpic ce-left ce-above"> <div class="ce-bodytext"> <p><strong>sgalinski Internet Services</strong><br> Proprietor: Stefan Galinski<br> Bahnhofstr. Gernrode 52<br> 37339 Gernrode</p> </div> </div> </div> <div id="c15101" class="default-content-element"><a id="c24443" class="ce-id-anchor"></a><p class="lead"><a href="https://twitter.com/sgalinski" target="_blank" rel="noopener nofollow"><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://www.sgalinski.de/news.xml" target="_blank" rel="noopener"><span class="fa fa-rss"></span> News Feed</a></p><p><a href="/en/impressum/"><span class="fa fa-external-link-square"></span> Imprint</a><br /><a href="/en/data-protection/"><span class="fa fa-external-link-square"></span> Data Protection</a><br /><a href="/en/html-sitemap/"><span class="fa fa-external-link-square"></span> Sitemap</a></p><p><a href="/unternehmen/kontakt/"><span class="fa fa-envelope"></span> Contact</a></p></div> </div> </div> </div> </div> <div class="copyright-footer"> <div class="container"> © sgalinski Internet Services. Implemented by the TYPO3 agency <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"> Do you have any questions? <br/> Contact us! <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>