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 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.

    • By MateThemes
      Hello everyone!
      I have a markup and image field question:
      I have a markup in which a gallery preview should be displayed on home page. This gallery have a special markup, 3 of 4 images have special image ratio.

      The gallery looks like this. 
      The html markup is like this:
      <div class="uk-section-muted" uk-scrollspy="target: [uk-scrollspy-class]; cls: uk-animation-slide-top-small; delay: 200;"> <div data-src="./assets/images/arrahof/home-restaurant-bg.svg" class="uk-background-norepeat uk-background-contain uk-background-top-center uk-section uk-section-large" uk-img> <div class="uk-container uk-container-small"> <div class="uk-margin-large" uk-grid> <div class="uk-width-1-1@m"> <h2 class="uk-text-center" uk-scrollspy-class>Das Angebot im ArraHof</h2> </div> </div> <div class="uk-grid-small uk-grid-margin-small" uk-grid> <div class="uk-width-expand@s"> <div class="uk-margin-remove-vertical uk-text-center" uk-scrollspy-class> <a class="el-container uk-inline-clip uk-transition-toggle uk-link-reset" href="#"> <img class="el-image" data-src="https://via.placeholder.com/610x604" data-sizes="(min-width: 610px) 610px" data-width="610" data-height="604" alt="Placeholder Image" uk-img> <div class="uk-overlay-default uk-transition-fade uk-position-cover"></div> <div class="uk-position-center uk-position-small"> <div class="uk-overlay uk-padding-large uk-transition-fade uk-margin-remove-first-child"> <h3 class="el-title uk-h4 uk-heading-divider uk-transition-slide-top-small uk-margin-top uk-margin-remove-bottom">Lorem Ipsum</h3> <div class="el-content uk-panel uk-transition-slide-bottom-small uk-margin-top">Comfort Food</div> </div> </div> </a> </div> </div> <div class="uk-width-expand@s"> <div class="uk-margin-remove-vertical uk-text-center" uk-scrollspy-class> <a class="el-container uk-inline-clip uk-transition-toggle uk-link-reset" href="#"> <img class="el-image" data-src="https://via.placeholder.com/610x604" data-sizes="(min-width: 610px) 610px" data-width="610" data-height="604" alt="Placeholder Image" uk-img> <div class="uk-overlay-default uk-transition-fade uk-position-cover"></div> <div class="uk-position-center uk-position-small"> <div class="uk-overlay uk-transition-fade uk-margin-remove-first-child"> <h3 class="el-title uk-h4 uk-heading-divider uk-transition-slide-top-small uk-margin-top uk-margin-remove-bottom">The Williams family</h3> <div class="el-content uk-panel uk-transition-slide-bottom-small uk-margin-top">Comfort Food</div> </div> </div> </a> </div> </div> </div> <div class="uk-grid-small uk-grid-margin-small" uk-grid uk-height-match="target: .uk-card; row: false"> <div class="uk-width-2-3@s"> <div class="uk-margin-remove-vertical uk-text-center" uk-scrollspy-class> <a class="el-container uk-inline-clip uk-transition-toggle uk-link-reset" href="#"> <img class="el-image" data-src="https://via.placeholder.com/610x400" data-width="610" data-height="400" alt="Placeholder Image" uk-img> <div class="uk-overlay-default uk-transition-fade uk-position-cover"></div> <div class="uk-position-center uk-position-small"> <div class="uk-overlay uk-transition-fade uk-margin-remove-first-child"> <h3 class="el-title uk-h4 uk-heading-divider uk-transition-slide-top-small uk-margin-top uk-margin-remove-bottom">The Williams family</h3> <div class="el-content uk-panel uk-transition-slide-bottom-small uk-margin-top">Comfort Food</div> </div> </div> </div> </a> </div> <div class="uk-width-expand@s"> <div class="uk-margin-remove-vertical uk-text-center" uk-scrollspy-class> <a class="el-container uk-inline-clip uk-transition-toggle uk-link-reset" href="#"> <img class="el-image" data-src="https://via.placeholder.com/610x820" data-sizes="(min-width: 610px) 610px" data-width="610" data-height="820" alt="Placeholder Image" uk-img> <div class="uk-overlay-default uk-transition-fade uk-position-cover"></div> <div class="uk-position-center uk-position-small"> <div class="uk-overlay uk-transition-fade uk-margin-remove-first-child"> <h3 class="el-title uk-h4 uk-heading-divider uk-transition-slide-top-small uk-margin-top uk-margin-remove-bottom">The Williams family</h3> <div class="el-content uk-panel uk-transition-slide-bottom-small uk-margin-top">Comfort Food</div> </div> </div> </div> </a> </div> </div> </div> <div class="uk-margin-large" uk-grid> <div class="uk-width-1-1@m"> <div class="uk-text-lead uk-width-xxlarge uk-margin-auto uk-text-center" uk-scrollspy-class>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur.</div> <div class="uk-margin-medium uk-text-center" uk-scrollspy-class> <a class="el-content uk-button uk-button-default uk-button-large" href="#">Unterkunft</a> </div> </div> </div> </div> </div> How can I achieve when I have an image field to add the custom markup within the image field? I have no clue to get this done.
      Thank you!
×
×
  • Create New...