Jump to content

Recommended Posts

Posted

Hi @Mike Rockett! Loving the module, it is such a timesaving module! I was just quickly wondering if there would be a way to add "www." after either "http://" or "https://" since I had included those in my original sitemap?

Posted

Hi @marie.mdna

if i'm not wrong this depends on your config file $config->httpHosts var, if the first host in the array contains the www, the sitemap will use it too (at least, that's what happens for all the websites, a lot..., for which i've this module installed ?

have a nice day

  • Like 1
Posted
1 hour ago, virtualgadjo said:

Hi @marie.mdna

if i'm not wrong this depends on your config file $config->httpHosts var, if the first host in the array contains the www, the sitemap will use it too (at least, that's what happens for all the websites, a lot..., for which i've this module installed ?

have a nice day

perfect! That's the point I got missing!

Posted (edited)
On 11/9/2022 at 11:02 AM, virtualgadjo said:

Hi @marie.mdna

if i'm not wrong this depends on your config file $config->httpHosts var, if the first host in the array contains the www, the sitemap will use it too (at least, that's what happens for all the websites, a lot..., for which i've this module installed ?

have a nice day

It's important that this is the case too because otherwise you could potentially be informing search engines you are using a different primary domain to one your site it actually using.

Edited by Guy Incognito
Spotted a typo
  • Like 1
  • 2 weeks later...
Posted
On 11/9/2022 at 2:39 PM, Guy Incognito said:

It's important that this is the case too because otherwise you could potentially be informing site engines you are using a different primary domain to one your site it actually using.

Indeed, I tried the module for the first time on a test website where I didn't care much about any SEO (so nothing had been really set for this purpose) but was then testing for upcoming projects!

Posted

Hi,

two more litte cents ?
if this hosts var is not well filled you may also run into another little problem as pw automatically build the preview links in the admin based on this var

have a nice day

  • Like 1
  • 1 month later...
  • 2 months later...
Posted

Hi @Mike Rockett I just discovered that the sitemap is always generated, no matter what cache settings. 

In https://github.com/mikerockett/markup-sitemap/blob/2db851e9bc3e7147879dced1bcfe515cd86562a8/MarkupSitemap.module.php#L269 the generation is done before checking for cache and returning cached output.

I amended the method to read

  protected function getSitemap(string $rootPage): string
  {
    
    // Bail out early if debug mode is enabled, or if the
    // cache rules require a fresh Sitemap for this request.
    if ($this->requiresFreshSitemap()) {
      $sitemap = $this->buildNewSitemap($rootPage);
      return $sitemap;
    }

    // Cache settings
    $cacheTtl = $this->cache_ttl ?: 3600;
    $cacheKey = 'MarkupSitemap';
    $cacheMethod = $this->cache_method ?: 'MarkupCache';

    // Attempt to fetch sitemap from cache
    $cache = $cacheMethod == 'WireCache'
      ? $this->cache
      : $this->modules->MarkupCache;

    $output = $cache->get($cacheKey, $cacheTtl);

    // If output is empty, generate and cache new sitemap
    if (empty($output)) {
      header('X-Cached-Sitemap: no, next-request');
      $sitemap = $this->buildNewSitemap($rootPage);

      $output = $sitemap;

      if ($cacheMethod == 'WireCache') {
        $cache->save($cacheKey, $output, $cacheTtl);
      } else {
        $cache->save($output);
      }

      return $output;
    }

    header('X-Cached-Sitemap: yes');

    return $output;
  }

This seems to be working fine.

  • Like 1
Posted
2 minutes ago, adrian said:

Thanks @gebeer - I have always had a bit of a hunch this might be the case but never got around to checking.

Building the sitemap for more than 500 URLs takes quite some time. That's why I noticed.

Posted

The other thing that I think should be implemented is a better cache expiry option - given how infrequently sitemap.xml files are called by search engines, I don't really think any sort of time based expiry is much use in reality. I think it should support wireCache's selector option (set to expire when any page is saved - although on regularly updated sites, even this might not result in the cache being used very often).

  • Like 1
Posted

Hi guys,

I'm afraid I don't have the time to maintain this module, and would prefer if someone took it over, along with Jumplinks. The simple reality is that I don't do website development anymore and, by extension, don't use PW anymore, and so I feel it best that these modules be handed over to someone who is active with PW and would be happy to take them over. If you'd like to do so, please drop me a DM and we can take it from there.

  • 2 months later...
Posted

Hi all,

I've released 0.9.0, which brings the minimum PHP version to 7.4, adds support for PHP 8, and adds support for Composer 2.

Also released 0.9.1 which handles @gebeer's suggestion (thanks!).

Note, however, that I've published these versions on a hunch that they will be ok – I do not have a PW setup for testing. If something is broken, let me know and I'll fix it.

  • Like 4
  • 5 months later...
  • 7 months later...
Posted

Hey @Mike Rockett, thanks for this module! ? 

I was wondering whether it's already possible to exclude certain languages, e.g. using a hook. I have a website that has a few languages installed, but one language is used only for internal stuff and the pages should not be accessed from the outside. What can I do to prevent MarkupSitemap from outputting links to page versions using one specific language completely (even if the language version is "active" on many pages)?

  • 1 year later...
Posted

@Mike Rockett is here a way to arbitrarily hook into the sitemap build process and exclude pages? I have a specific scenario where it would need to be a hook to skip pages, not a manual list or specific template.

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
×
×
  • Create New...