Recommended Posts

17 minutes ago, Mike Rockett said:

Now that I think about it, we do actually need a way to set the iso for sites that do not use a home page name for the default language.

Okay, I've set it up to use a custom ISO configuration option for the default language. It only works when the home page's default language name is empty (which is "home" when processed) and LanguageSupportPageName's useHomeSegment is set to false.

Output:

    <url>
        <loc>http://pw-modules.local/</loc>
        <lastmod>2017-09-15T18:41:07+02:00</lastmod>
        <xhtml:link rel="alternate" hreflang="en" href="http://pw-modules.local/"/>
        <xhtml:link rel="alternate" hreflang="de" href="http://pw-modules.local/de/"/>
        <xhtml:link rel="alternate" hreflang="fi" href="http://pw-modules.local/fi/"/>
    </url>
    <url>
        <loc>http://pw-modules.local/de/</loc>
        <lastmod>2017-09-15T18:41:07+02:00</lastmod>
        <xhtml:link rel="alternate" hreflang="en" href="http://pw-modules.local/"/>
        <xhtml:link rel="alternate" hreflang="de" href="http://pw-modules.local/de/"/>
        <xhtml:link rel="alternate" hreflang="fi" href="http://pw-modules.local/fi/"/>
    </url>
    <url>
        <loc>http://pw-modules.local/fi/</loc>
        <lastmod>2017-09-15T18:41:07+02:00</lastmod>
        <xhtml:link rel="alternate" hreflang="en" href="http://pw-modules.local/"/>
        <xhtml:link rel="alternate" hreflang="de" href="http://pw-modules.local/de/"/>
        <xhtml:link rel="alternate" hreflang="fi" href="http://pw-modules.local/fi/"/>
    </url>
    <url>
        <loc>http://pw-modules.local/about/</loc>
        <lastmod>2017-09-15T17:57:17+02:00</lastmod>
        <xhtml:link rel="alternate" hreflang="en" href="http://pw-modules.local/about/"/>
        <xhtml:link rel="alternate" hreflang="de" href="http://pw-modules.local/de/uber/"/>
        <xhtml:link rel="alternate" hreflang="fi" href="http://pw-modules.local/fi/tietoja/"/>
    </url>
    <url>
        <loc>http://pw-modules.local/de/uber/</loc>
        <lastmod>2017-09-15T17:57:17+02:00</lastmod>
        <xhtml:link rel="alternate" hreflang="en" href="http://pw-modules.local/about/"/>
        <xhtml:link rel="alternate" hreflang="de" href="http://pw-modules.local/de/uber/"/>
        <xhtml:link rel="alternate" hreflang="fi" href="http://pw-modules.local/fi/tietoja/"/>
    </url>
    <url>
        <loc>http://pw-modules.local/fi/tietoja/</loc>
        <lastmod>2017-09-15T17:57:17+02:00</lastmod>
        <xhtml:link rel="alternate" hreflang="en" href="http://pw-modules.local/about/"/>
        <xhtml:link rel="alternate" hreflang="de" href="http://pw-modules.local/de/uber/"/>
        <xhtml:link rel="alternate" hreflang="fi" href="http://pw-modules.local/fi/tietoja/"/>
    </url>

 

Share this post


Link to post
Share on other sites
8 hours ago, Mike Rockett said:

Home Page default language name

sitemap02.jpeg.de30965b3f9cc18fa473ef1b86799ba0.jpeg

 

Hi @Mike Rockett, i knew that "trick". But i don't want my default language urls (german/de) look like: sample.de/de/contact,
or is there any option to remove that url segment of the default language in the url when having a default language name in "Home > Settings"?

 

EDIT: Ah forget it, i just updated the module to version 0.20 and saw "ISO code for default language" :rolleyes::rolleyes:

  • Like 1

Share this post


Link to post
Share on other sites

Bumped to 0.2.2-beta:

  • Explicitly requires PW 3+ and PHP 5.6+
  • Fixes a namespace issue that broke install and uninstall routines

I'd very much appreciate it if everyone who would like to use MarkupSitemap tests it and provides some feedback. By the looks of it, this can be pushed to stable 1.0.0 soon, unless any other bugs come up... Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

Bumped to 0.2.4-beta:

  • Fixes schema changes (per ThePixelDeveloper's recent commits). Note that the sitemap doesn't render using the XML viewer, and it's still to be tested in Search Console.
  • A few changes to ModuleConfig. Adding image fields to the sitemap is now only possible if your site contains image fields.
  • Hook priority is changed (from after to before). This is mostly due to SystemNotifications showing a 404 for the sitemap.xml route.
  • add X-SitemapRetrievedFromCache header for debugging purposes.

PS, I'm working on a new docs site as well. It'll be powered by PW, and will have docs for all my modules.

On a separate note: Jumplinks is on the mantleshelf for a little while as I'd like to do a refactor to make the code a little more 'lean' and my schedule is not what it once was. There are a few things bugging me with regards to the way it's put together at the moment, and it feels a little chunky. Sorry for the delay on that one, guys...

  • Like 3

Share this post


Link to post
Share on other sites

Hey there,

tried to install the module this evening, but got the following error at the installation:

Error: Uncaught Error: Class 'Field' not found in /site/modules/MarkupSitemap/src/Utilities/Fields.php:49
Stack trace:
#0 site/modules/MarkupSitemap/MarkupSitemap.module.php(90): MarkupSitemap->createField('FieldsetOpen', 'sitemap_fieldse...', Array, true)
#1 wire/core/Wire.php(380): MarkupSitemap->___install()
#2 wire/core/WireHooks.php(698): ProcessWire\Wire->_callMethod('___install', Array)
#3 wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(MarkupSitemap), 'install', Array)
#4 wire/core/Modules.php(1688): ProcessWire\Wire->__call('install', Array)
#5 wire/core/Wire.php(386): ProcessWire\Modules->___install('MarkupSitemap', Array)
#6 /www/htdocs (line 49 of site/modules/MarkupSitemap/src/Utilities/Fields.php) 

This error message was shown because: you are logged in as a Superuser. Error has been logged.

I'm running the 3.0.77 dev branch!

Thanks for the great module, by the way! 

  • Like 1

Share this post


Link to post
Share on other sites

@backes - I see... For some reason, it was working on my side. Was trying to add suport for ProcessWire 2.8, and it did appear to work in 3.0. As you are using PW3, please change the reference in Fields.php to the following:

$field = new \ProcessWire\Field();

This is at https://github.com/rockettpw/markup-sitemap/blob/master/src/Utilities/Fields.php#L49

I would change it myself, but am making considerable changes to the module at the moment, whereby the fields don't actually get installed, but rather appened to the page editor when it loads, and then saved to module config, instead of each page. This keeps everything centralised. Work commitments at the moment, so will get back to this in about a week.

Share this post


Link to post
Share on other sites

Bumped to 0.3.0-beta:

This release makes considerable changes to the way in which the module works. Here's the breakdown of notable changes in this release:

No more page fields

Instead of using actual attached fields on a page-by-page basis, the module now saves related data in a centralised manner to its own configuration, and page fields are built on the fly when needed.

This means that, when a template is defined in the module's config to use sitemap options and is later removed from the list, sitemap options for affected pages are not removed. Should the template be added to the list at a later stage, all saved options for pages belonging to that template are 'restored', simply meaning that the module will refer to them during the build process.

The only time sitemap options for a page are removed is when either the page in question is deleted after having been trashed, or when the module is uninstalled (everything gets deleted, in this case).

Stylesheet

Due to a bug in Chrome (and possibly other browsers, though untested), the stylesheet is now turned on by default. Further, small aesthetic changes were made to the stylesheet, and a bug regarding the priority column was fixed.

Commit da42cb7 changelog:

  • alter stylesheet
  • use separate class-loader
  • separate methods to traits
  • bind options to module-config, instead of page-fields
  • use stylesheet by default
  • add debug trait
  • remove gitignore stuff we don't need

Requirements

The module now requires at least ProcessWire 2.8.16+ or 3.0.16+, due to the use of saveConfig and getConfig.

Upgrade notes

As the module is in Beta, there is no upgrade path. You will need to uninstall Sitemap before installing it again if you would like to remove the redundant system fields. If it doesn't matter, then a normal upgrade will do fine.

  • Like 3

Share this post


Link to post
Share on other sites

Just pushed RC2 - was not checking the PW version properly (it requires either 2.8.16 or 3.0.16 to run).

Speaking of PW versioning: Not sure if this has been brought up before (please point me to it if it has), but how will the legacy version be bumped when we reach PW 3.1? Would be unwise to make it 2.9 because, when we reach 3.2, legacy would logically need to be 3.0. Perhaps there are plans to drop legacy?

Share this post


Link to post
Share on other sites

Hey @Mike Rockett,

had some days off, so now back at the laptop and checking it out.

Seems to work fine now in the 0.3.2 version! Thank you!

Martin

  • Like 1

Share this post


Link to post
Share on other sites

Hello again,

is there a way to add hidden pages to the Sitemap? I'm used to make some hidden pages for several not so important pages.

Thanks, Martin

Share this post


Link to post
Share on other sites
14 minutes ago, backes said:

Hello again,

is there a way to add hidden pages to the Sitemap? I'm used to make some hidden pages for several not so important pages.

Thanks, Martin

I'd probably need to include a selector-toggle for that - perhaps a simple option in the module's configuration that allows for the inclusion of hidden pages. With that said, I do discourage it. If a page is meant to be hidden, then it shouldn't be shown, no? What exactly are you hiding your pages from?

Share this post


Link to post
Share on other sites

Currently I'm using the hidden/not hidden for navigation purposes. For example, the not hidden pages will be rendered in the primary navigation and the hidden stuff goes with specific page calls in several meta navigations.

Or do you have any better workflow for the page structuring, that's also understandable by clients? :D

Share this post


Link to post
Share on other sites
6 hours ago, backes said:

Currently I'm using the hidden/not hidden for navigation purposes. For example, the not hidden pages will be rendered in the primary navigation and the hidden stuff goes with specific page calls in several meta navigations.

Or do you have any better workflow for the page structuring, that's also understandable by clients? :D

I'd be inclined to use Menu Builder in that case, in terms of seperation of your menus, if that's what this is about. To me, I feel that setting page visibility just for the purposes of menus is a tad overkill (keep in mind that I've never had to hide a page from lists and searches before). That said, your structure could be very specific, and I may be missing something here...

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Good point. :) I'll try to use the MenuBuilder in my current project. It looks promising, so I don't have to tell clients, what to hide and what not!

Thanks for this tip!

  • Like 1

Share this post


Link to post
Share on other sites

Hi Mike,

Thank you for your excellent module. A wish : we have a big website where product pages are stored under a parent (a series =>  parent: series-carpet, children: sku-carpet, this is handy for our client to see the SKUs associated to a collection). These children are not hidden for search purpose, but are hidden from the navigation and, hence, from search engines. Your module generates for that site a 10000 sitemap list because the children are included. We can't go from series to series to disallow the sitemap generation for the children.

In other words. Your module allows us to include/exclude sitemap generation for actual pages. It would be very convenient to disallow/allow a sitemap for a whole template from the template settings.

Share this post


Link to post
Share on other sites

@Guy Verville – It looks like the template process doesn’t give me as much flexibility that the page edit process does. As such, I think I’ll dump this the module config. Truthfully, I actually think it’ll be better this way. :-)

Edit: I’ve bumped to 0.3.3 RC2.2:

You can now exlude templates via the config page. If templates are included (for sitemap options) via config, those inclusions will simply be ignored (non-destructive so that restoring access is simple).

Please let me know if this works smoothly for you.

Related commit: https://github.com/rockettpw/markup-sitemap/commit/4981b9b537bce556ba15d4eacac0d095fea170da

  • Like 1

Share this post


Link to post
Share on other sites

Thank you very much for this nice addition! I will give it to my programmer (he had created his own solution inspired by your module and tightly integrated wit the existing code, but your config approach is more convenient and will certainly help a lot of people here).

PS: I have installed in my modest and personal website and works like a charm. http://www.guyverville.com/sitemap.xml

OperaScreenSnapz129.png

  • Like 3

Share this post


Link to post
Share on other sites

I'd like to get some general feedback from people using the module. If you have a minute, please share your experiences or issues (even those that are self-resolved, if any). If it's looking stable enough, I'd like to bump to stable v1. If there are issues, please also feel free to let me know. Thanks!

  • Like 2

Share this post


Link to post
Share on other sites

I am using the module on various multilingual sites and it's working fine!

When you have Jumplinks installed it sometimes hits an 404 on /sitemap.xml even though the link/sitemap is working.
Do you have to create an extra page and template  (xml header) for it?
 

  • Like 1

Share this post


Link to post
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 Marco Angeli
      Hi there,
      I added a ssl certificate to my site and I'd like to redirect every single http url to its new https version
      So I added this code in the .htacces file, after the RewriteEngine On :
      Redirect 301 /about https://www.mysite.it/about
      Unfortunately this is now working: I get the "too many redirects" error.
      The following code works, but it's a bulk redirection to the home page, something I don't want for SEO reasons (https://moz.com/blog/save-your-website-with-redirects😞
      RewriteCond %{HTTP_HOST} mysite\.it [NC]
      RewriteCond %{SERVER_PORT} 80
      RewriteRule ^(.*)$ https://www.mysite.it/$1 [R,L]
      Any suggestions?
    • By gebeer
      Hi,
      just wanted to share something I came across while working on an import module for XML data from a web service. The XML I got was not huge, but still, loading around 3.5 MB of XML with 250+ large child nodes into memory at once with simplexml_load_file() and then looping over it had significant impact on performance.
      I searched for a solution and found this great article about how to parse large XML files.
      It basically explains how to utilize the native XMLReader class together with SimpleXMLElement to handle such situations in a memory efficient way.
      After implementing it I got a significant improval on perceived performance. No comparison in numbers to share here as I'm a bit short on time.
    • By chrizz
      hey there
      I guess a lot of you have already heard of the hreflang attribute which tells search engines which URL they should list on their result pages. For some of my projects I build this manually but now I am wondering if there's need to add this as a module to PW modules directory. 
      How do you deal with the hreflang thingy? Would you you be happy if you can use a module for this or do you have concerns that using a module maybe does not cover your current use cases?
      Cheers,
      Chris
       
       
       
       
    • By FrancisChung
      Hi, I have an ongoing issue with Google SEO that I can't seem to fix. Wondering if anyone has come across a similar situation?

      We deployed a new version of the website using a new deployment methodology and unfortunately, the wrong robots.txt file was deployed basically telling Googlebot not to scrape the site.

      The end result is that if our target keywords are used for a (Google) search, our website is displayed on the search page with "No information is available for this page." 

      Google provides a link to fix this situation on the search listing, but so far everything I have tried in it hasn't fixed the situation.
      I was wondering if anyone has gone through this scenario and what was the steps to remedy it?
      Or perhaps it has worked and I have misunderstood how it works?

      The steps I have tried in the Google Webmaster Tool :
      Gone through all crawl errors Restored the Robots.txt file and Verified with Robots.txt tester Fetch/Fetch and Render as Google as both Desktop/Mobile, using root URL and other URLs, using Indexing Requested / Indexing Requested for URL and Linked Pages. Uploaded a new Sitemap.xml  Particularly on the Sitemap page, it says 584 submitted, 94 indexed.
       
      Would the Search Engine return "No Information available" because the page is not indexed? The pages I'm searching for are our 2 most popular keywords and entry points into site. It's also one of 2 most popular category pages.  So I'm thinking it probably isn't the case but ...

      How can I prove / disprove the category pages are being indexed?

      The site in questions is Sprachspielspass.de. The keywords to search are fingerspiele and kindergedichte.

       
    • By John W.
      SYNOPSIS
      A little guide to generating an sitemap.xml using (I believe) a script Ryan originally wrote with the addition of being able to optionally exclude child pages from being output in the sitemap.xml file.
      I was looking back on a small project today where I was using a php script to generate an xml file, I believe the original was written by Ryan. Anyway, I needed a quick fix for the script to allow me to optionally exclude children of pages from being included in the sitemap.xml output.
      OVERVIEW
      A good example of this is a site where if you visit /minutes/ a page displays a list of board meetings which includes a title,  date, description and link to download the .pdf file.
      I have a template called minutes and a template called minutes-document. The first page, minutes, when loaded via /minutes/ simply grabs all of its child pages and outputs the name, description and actual path of an uploaded .pdf file for a visitor to download.
      In my back-end I have the template MINUTES and MINUTES-DOCUMENT. Thus:


      So, basically, their employee can login, hover over minutes, click new, then create a new (child) record and name it the date of the meeting e.g. June 3rd, 2016 :

       
      ---------------------------
      OPTIONALLY EXCLUDING CHILDREN - SETUP
      Outputting the sitemap.xml and optionally excluding children that belong to a template.
      The setup of the original script is as follows:
      1. Save the file to the templates folder as sitemap.xml.php
      2. Create a template called sitemap-xml and use the sitemap.xml.php file.
      3. Create a page called sitemap.xml using the sitemap-xml template
       
      Now, with that done you will need to make only a couple of slight modifications that will allow the script to exclude children of a template from output to the sitemap.xml
      1. Create a new checkbox field and name it:   sitemap_exclude_children
      2. Add the field to a template that you want to control whether the children are included/excluded from the sitemap. In my example I added it to my "minutes" template.
      3. Next, go to a page that uses a template with the field you added above. In my case, "MINUTES"
      4. Enable the checkbox to exclude children, leave it unchecked to include children.
      For example, in my MINUTES page I enabled the checkbox and now when /sitemap.xml is loaded the children for the MINUTES do not appear in the file.

       
      A SIMPLE CONDITIONAL TO CHECK THE "sitemap_exclude_children" VALUE
      This was a pretty easy modification to an existing script, adding only one line. I just figure there may be others out there using this script with the same needs.
      I simply inserted the if condition as the first line in the function:
      function renderSitemapChildren(Page $page) { if($page->sitemap_exclude_children) return ""; ... ... ...  
      THE FULL SCRIPT WITH MODIFICATION
      <?php /** * ProcessWire Template to power a sitemap.xml * * 1. Copy this file to /site/templates/sitemap-xml.php * 2. Add the new template from the admin. * Under the "URLs" section, set it to NOT use trailing slashes. * 3. Create a new page at the root level, use your sitemap-xml template * and name the page "sitemap.xml". * * Note: hidden pages (and their children) are excluded from the sitemap. * If you have hidden pages that you want to be included, you can do so * by specifying the ID or path to them in an array sent to the * renderSiteMapXML() method at the bottom of this file. For instance: * * echo renderSiteMapXML(array('/hidden/page/', '/another/hidden/page/')); * * patch to prevent pages from including children in the sitemap when a field is checked / johnwarrenllc.com * 1. create a checkbox field named sitemap_exclude_children * 2. add the field to the parent template(s) you plan to use * 3. when a new page is create with this template, checking the field will prevent its children from being included in the sitemap.xml output */ function renderSitemapPage(Page $page) { return "\n<url>" . "\n\t<loc>" . $page->httpUrl . "</loc>" . "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>" . "\n</url>"; } function renderSitemapChildren(Page $page) { if($page->sitemap_exclude_children) return ""; /* Aded to exclude CHILDREN if field is checked */ $out = ''; $newParents = new PageArray(); $children = $page->children; foreach($children as $child) { $out .= renderSitemapPage($child); if($child->numChildren) $newParents->add($child); else wire('pages')->uncache($child); } foreach($newParents as $newParent) { $out .= renderSitemapChildren($newParent); wire('pages')->uncache($newParent); } return $out; } function renderSitemapXML(array $paths = array()) { $out = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; array_unshift($paths, '/'); // prepend homepage foreach($paths as $path) { $page = wire('pages')->get($path); if(!$page->id) continue; $out .= renderSitemapPage($page); if($page->numChildren) { $out .= renderSitemapChildren($page); } } $out .= "\n</urlset>"; return $out; } header("Content-Type: text/xml"); echo renderSitemapXML(); // Example: echo renderSitemapXML(array('/hidden/page/'));  
      In conclusion, I have used a couple different processwire sitemap generating modules. But for my needs, the above script is fast and easy to setup/modify.
      - Thanks