Jump to content

MarkupSitemap


Mike Rockett

Recommended Posts

New Maintainer Needed

Sitemap is in need of developer to take over the project. There are a few minor issues with it, but for the most part, most scenarios, it works, and it works well. However, I'm unable to commit to further development, and would appreciate it if someone could take it over. If you're interested, please send me a private message and we can take it from there. Thanks! 🙂

Link to comment
Share on other sites

  • 1 month later...

Hi

I'm using this module for the first time in a multilingual website.

In my home, language prefix are empty because I manage URL directly:

  1. mydomain.fr for French
  2. mydomain.com for English
  3. mydomain.de for Deutsch

The the MarkupSitemap module rendered something like that for each page (on mydomain.fr), after set default language (in module settings) to "fr" :

<xhtml:link rel="alternate" hreflang="fr" href="https://mydomain.fr/"/>
<xhtml:link rel="alternate" hreflang="" href="https://mydomain.fr/"/>
<xhtml:link rel="alternate" hreflang="" href="https://mydomain.fr/"/>

But I would like to render :

<xhtml:link rel="alternate" hreflang="fr" href="https://mydomain.fr/"/>
<xhtml:link rel="alternate" hreflang="en" href="https://mydomain.com/"/>
<xhtml:link rel="alternate" hreflang="de" href="https://mydomain.de/"/>

I tried to use Hook like that :

wire()->addHookAfter(MarkupSitemap::getAdditionalPages, function ($event) {
    $page = $event->arguments(0);
    $language = $event->arguments(1);

    MarkupSitemap::applyLanguageSupportHooks();

    return [
        'url' => 'https://mydomain.fr/test',
        'fr' => [
            'url' => 'https://mydomain.fr/test',
        ],
		'en' => [
			'url' => 'https://mydomain.com/test',
		]
        'de' => [
            'url' => 'https://mydomain.de/test',
        ],
    ];
});

But the sitemap rendering is the same. How can use the Hook to set alternate language URL from pages ?

Link to comment
Share on other sites

  • 1 month later...

@Mike Rockett can you please change only 1 word in order to enable cache busting image urls?

On the file SupportsImages.php at the line 28 change the httpUrl to uppercase: HTTPURL

$locImage = new Image($image->HTTPURL);

With this change you will support both PW core's and ProCache cache busting.

Link to comment
Share on other sites

@sebr Apologies for not responding sooner. I don't use PW anymore as my line of work is now in SaaS – as such, I can't really remember how everything works when it comes to multii language. I'll need to find some time to dig into this. If there's anyone around that could assist with a merge request, that'd be great too 🙂

@PWaddict I have never used ProCache, so not sure how that works… Are you 100% sure that using the uppercase getter will fallback accordingly if ProCache does not process it (the getter)? I don't want to break anyone’s site by rolling this change out…

Link to comment
Share on other sites

@sebr Hello. Could you try changing your hook code from this:

wire()->addHookAfter(MarkupSitemap::getAdditionalPages, function ($event) {

to this:

wire()->addHookAfter("MarkupSitemap::getAdditionalPages", function ($event) {

?

Link to comment
Share on other sites

6 hours ago, Mike Rockett said:

I have never used ProCache, so not sure how that works… Are you 100% sure that using the uppercase getter will fallback accordingly if ProCache does not process it (the getter)? I don't want to break anyone’s site by rolling this change out…

Yes, I'm 100% sure. ProcessWire has 2 properties for cache-busting, URL & HTTPURL.

Taken from https://processwire.com/api/ref/pageimage/:

HTTPURL string Same as the cache-busting uppercase “URL” property, but includes scheme and hostname.
 
URL string Same as $url property but with browser cache busting query string appended.

Taken from https://processwire.com/blog/posts/pw-3.0.98-procache-buster/:

ProcessWire's file and image fields (represented by Pagefile and Pageimage objects) already have an uppercase URL property which always returns a cache-busting version of the file's URL. This is the case whether you've got ProCache installed or not. But in ProcessWire master 3.0.96 or newer, ProCache Buster updates that URL property to use ProCache's enhanced buster, rather than the one built-in to the core.

Link to comment
Share on other sites

  • 4 weeks later...
9 hours ago, Peter Knight said:

Is there a way to output the sitemap as as sitemap.xml file?

The module readme says:

Quote

After installation, the sitemap will immediately be made available at /sitemap.xml.

If you’re looking for a basic sitemap, there’s nothing more you need to do.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By SwimToWin
      BACKGROUND
      SEO matters and so hiding pages behind a "section" is not necessarily good - example:
      Current practice is to show the pages "Foo, Bar, Baz" in a section. https://www.example.com/resources/foo https://www.example.com/resources/bar https://www.example.com/resources/baz For SEO reasons, it's better to show the page at root level like so: https://www.example.com/foo https://www.example.com/bar https://www.example.com/baz PROBLEM: LACK OF ORGANIZATION WHEN ALL PAGES ARE PUBLISHED AT ROOT LEVEL
      This design is fully possible today. However, the root folder becomes disorganized when all pages are published in the root - and the pages tree structure is not of much use when all pages are published in the root.
      SOLUTION: VIRTUAL PAGES TO THE RESCUE
      As a publisher, when publishing many pages that have a root level url, I want to organize my pages below a Virtual Page (that doesn't have a url), so that pages are organized in a Pages Tree Structure (using "Virtual Pages").
      What is a "Virtual Page"?
      Virtual Page can never have a name (Admin -> Page -> Settings -> Name). The Name field is simply blank The Name field is never used in the url for child pages. Virtual Page is a container used to organize other pages. Virtual Page is never shown in the front-end. Virtual Page is shown in the Editing interface only. Virtual Page might have a Template - but the template can only be used in the Admin interface. Virtual Page might have fields (Title, Summary, Text etc.) - but the contents cannot be shown online.
    • By Sanyaissues
      I hadn't developed a website for a while, but here we are. It's a very simple minimalist website to showcase the latest work of Dominican Artist Patricia Abreu Mota.
      Site: https://patriabreu.com
      Modules:
      Procache ❤️ Seo Maestro Profiler Pro Lister Pro ProcessRedirects
    • By jploch
      Hey folks,
      currently Iam working on a website for one of my clients and I need some advice on how to approach this in PW.
      The website is for a company, that offers holiday houses in two locations. 

      The client wants the homepage to show the first location. Normally I just have a home template for the first page, but here the URL should reflect that you are in Location 1. So when you visit the URL casamani.com it should redirect to casamani.com/location-1. Not sure if this makes sense at all.

      Whould it be bad for SEO and performance reasons to redirect home to the Location-1 page?
      Another approach would be to render the Location-1 template on the home template or do an include like discussed here.
      Here is how the tree looks:
      – Home
      – Location 1 (Homepage)
           – Creation
           – Adventure
           – Sustainability
      – Location 2 
           – Creation
           – Adventure
           – Sustainability

      Thanks for looking into this!
    • By daniel_puehringer
      Hey,

      so we all know about SEO and the importance of performance. Basically we do it, because if no one finds the website we just built, it´s frustrating. We all try to write clean markup, css and js code and most might have a webpack/gulp/whatever pipeline to minimize css&js.
      But when thinking about it, optimizing your pipeline might save you a few (hundreds) of kb, compared to loading an image with 1 mb that´s literally nothing and frankly just ridiculous.

      Don´t get me wrong, frontend pipelines are great and should be used, but let´s shift your "I will optimize the shit out of that 3 css lines" focus to something different: try to serve images as fast as possible, this is where the performance boost really happens.

      I´m no pro on processwire so far, but I built a very easy to use picture element, which some of you could find interesting:

      1. the picture comes with 3 different sizes: one for mobile (keep in mind the double dpi, therefore width of 828px), one for tablet and one for desktop
      2. the picture generates a webp version and the original file extension as a fallback
      3. the filesize of each element is rendered within the "data" attribute
      4. lazy loading(sooo important!!!) is done via the native 'loading="lazy"' attribute.


      Please try it out and see the difference 🙂

      I posted this so others can easily optimize their images, but I would also like to hear your suggestions in making it better. Maybe you could decrease the rendering time or maybe you have some easy improvements.

      Please let me know.

      Greetings from Austria!


       
      <picture> <source data="<?php echo($oElement->repeater_image->width(828)->webp->filesize);?>" media="(max-width: 414px)" srcset="<?php echo($oElement->repeater_image->width(828)->webp->url) ?> 2x" type="image/webp"> <source data="<?php echo($oElement->repeater_image->width(828)->filesize) ?>" media="(max-width: 414px)" srcset="<?php echo($oElement->repeater_image->width(828)->url) ?> 2x" type="image/<?php echo($oElement->repeater_image->ext)?>"> <source data="<?php echo($oElement->repeater_image->width(767)->webp->filesize) ?>" media="(min-width: 415) and (max-width: 767px)" srcset="<?php echo($oElement->repeater_image->width(767)->webp->url) ?> 2x" type="image/webp"> <source data="<?php echo($oElement->repeater_image->width(767)->filesize) ?>" media="(min-width: 415) and (max-width: 767px)" srcset="<?php echo($oElement->repeater_image->width(767)->url) ?> 2x" type="image/<?php echo($oElement->repeater_image->ext)?>"> <source data="<?php echo($oElement->repeater_image->webp->filesize) ?>" media="(min-width: 768px)" srcset="<?php echo($oElement->repeater_image->webp->url) ?>" type="image/webp"> <source data="<?php echo($oElement->repeater_image->filesize) ?>" media="(min-width: 768px)" srcset="<?php echo($oElement->repeater_image->url) ?>" type="image/<?php echo($oElement->repeater_image->ext)?>"> <img data="<?php echo($oElement->repeater_image->filesize) ?>" class="img-fluid" loading="lazy" src="<?php echo($oElement->repeater_image->url) ?>" alt="<?php echo($oElement->repeater_image->description) ?>" type="image/<?php echo($oElement->repeater_image->ext)?>"> </picture>
    • By neophron
      Hi guys,
      after getting a complain message from google about a robots.txt (where everything is ok), I searched for an online tool, where I can test my robots.txt files. I found this website: https://technicalseo.com/tools/
      This page offers a bunch of nice tools, just wanted to share it with you.

×
×
  • Create New...