marie.mdna Posted November 9, 2022 Posted November 9, 2022 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?
virtualgadjo Posted November 9, 2022 Posted November 9, 2022 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 1
marie.mdna Posted November 9, 2022 Posted November 9, 2022 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!
JayGee Posted November 9, 2022 Posted November 9, 2022 (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 November 17, 2022 by Guy Incognito Spotted a typo 1
marie.mdna Posted November 17, 2022 Posted November 17, 2022 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!
virtualgadjo Posted November 17, 2022 Posted November 17, 2022 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 1
adrian Posted January 12, 2023 Posted January 12, 2023 @Mike Rockett - The issue is that it's an exclusion rather than an inclusion, so the children are already added before it gets back to the canBeIncluded check.
gebeer Posted March 26, 2023 Posted March 26, 2023 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. 1
adrian Posted March 26, 2023 Posted March 26, 2023 Thanks @gebeer - I have always had a bit of a hunch this might be the case but never got around to checking.
gebeer Posted March 26, 2023 Posted March 26, 2023 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.
adrian Posted March 26, 2023 Posted March 26, 2023 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). 1
Mike Rockett Posted April 1, 2023 Author Posted April 1, 2023 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.
Mike Rockett Posted June 2, 2023 Author Posted June 2, 2023 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. 4
Pete Posted November 10, 2023 Posted November 10, 2023 Can confirm this is caching properly now (tested using Wirecache option).
snck Posted June 17, 2024 Posted June 17, 2024 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)?
Pete Posted September 2 Posted September 2 @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.
Mike Rockett Posted September 30 Author Posted September 30 I'm no longer maintaining any of my modules. If someone wants to take them over, let me know. It's been a long time since I first asked, but nobody has reached out. 1
Pete Posted October 8 Posted October 8 Thanks Mike - my memory is so bad I didn't remember you posting that even though it was a few posts further up. Maybe I need to get my eyes checked whilst I'm at it 😅
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now