Recommended Posts

Mike Rockett    965

Version: 0.2.4-beta • License: MIT  Requires ProcessWire: 2.8+

Docs & Download: rockettpw/markup-sitemap
Modules Directory: MarkupSitemap

MarkupSitemap is essentially an upgrade to MarkupSitemapXML by Pete. It adds multi-language support using the built-in LanguageSupportPageNames. Where multi-language pages are available, they are added to the sitemap by means of an alternate link in that page's <url>. Support for listing images in the sitemap on a page-by-page basis and using a sitemap stylesheet are also added.

Example when using the built-in multi-language profile:

<url>
    <loc>http://domain.local/about/</loc>
    <lastmod>2017-08-27T16:16:32+02:00</lastmod>
    <xhtml:link rel="alternate" hreflang="en" href="http://domain.local/en/about/"/>
    <xhtml:link rel="alternate" hreflang="de" href="http://domain.local/de/uber/"/>
    <xhtml:link rel="alternate" hreflang="fi" href="http://domain.local/fi/tietoja/"/>
</url>

It also uses a locally maintained fork of a sitemap package by Matthew Davies that assists in automating the process.

The doesn't use the same sitemap_ignore field available in MarkupSitemapXML. Rather, it creates two fields that are available in a Page's Settings tab. The first field is for excluding a Page from the sitemap, and another is for excluding its children. You can assign which templates get these config fields in the module's configuration (much like you would with MarkupSEO). Note that the two options are mutually exclusive at this point as there may be cases where you don't want to show a parent page, but only its children. Whilst unorthodox, I'm leaving the flexibility there. (The home page cannot be excluded from the sitemap, so the fields won't be available there.)

Sitemap also allows you to include images for each page at the template level, and you can disable image output at the page level.

The module allows you to set the priority on a per-page basis (it's optional and will not be included if not set).

Lastly, a stylesheet option has also been added. You can use the default one, or set your own.

Note that if the module is uninstalled, the config fields are removed from all assigned templates and then deleted. I may add the option to keep the fields upon uninstallation (can be useful when debugging).

pwtalk-01.thumb.jpeg.a239282a9414e4c1882e7f8d787f4a4b.jpeg  pwtalk-02.jpeg.e0cdee14590b52c7d404f05bb9e48f21.jpeg  pwtalk-03.thumb.jpeg.9956b756b9e2aea59b6239e55bee0f4f.jpeg

  • Like 13
  • Thanks 1

Share this post


Link to post
Share on other sites
Mike Rockett    965

Bumped to 0.1.1-beta

  • Added image support:
    • You can now specify fields in module config that should be included when rendering the sitemap. Simply choose one or more image fields from the list, and any Page that uses those fields will have their images listed in the sitemap. If a description is present, it will be used as the image caption.
    • Also supports ImageExtra. To add specific details to your sitemap's image entries, use ImageExtra to add the meta fields accordingly:
      • Add a license field to set a license for the image (it must be a URL, or it won't be included)
      • Add a title, if needed
      • Add geo, location, or geolocation if you'd like to specify the geo-location of your images
  • The template field in ModuleConfig was changed from includeTemplates to sitemap_include_templates.
  • The ModuleConfig fields now show template and field labels, and not their names.
  • Small changes to the per-Page config field descriptions and labels

Share this post


Link to post
Share on other sites
mel47    16

Hi

Thanks for this module. I was googling tonight to find an how-to for building sitemap and see this. But I have 2 stupid questions:

  1. "Home" template is not available, is it because it's included by default?
  2. Where is the sitemap? domain.com/sitemap.xml brings me to my home page. Did I did something wrong? 

Thanks

Mel

Share this post


Link to post
Share on other sites
Mike Rockett    965

Hi Mel, You're most welcome.

1 hour ago, mel47 said:

"Home" template is not available, is it because it's included by default?

The list on the configuration page defines templates which get the sitemap_ignore_page and sitemap_ignore_children fields. As the home page should not be ignored, the home template does not get the fields (the module would be pretty much useless otherwise). The presentation of the sitemap works out of the box without any configuration.

Edit: I think the module config should be a little clearer with the explanation. I will sort that out now.

1 hour ago, mel47 said:

Where is the sitemap? domain.com/sitemap.xml brings me to my home page. Did I did something wrong?

The sitemap should be working at that URI. If you're looking for a simple sitemap, maybe use MarkupSitemapXML and see if it renders. If it does, then it means I've done something wrong with my module, which is based on that one.

:)

Share this post


Link to post
Share on other sites
Mike Rockett    965

Bumped to 0.1.2-beta

  • Fixed descriptions to better explain the purpose of the fields added to templates.
    If additional non-related fields are ever added, these descriptions will be amended accordingly.
     
  • Removes sitemap cache on module-save.
    This is already done when pages are saved, unless the option in MarkupCache's config dictates otherwise.
  • Like 2

Share this post


Link to post
Share on other sites
mel47    16

Thanks for clarification.

To be honest, I already tried MarkupSitemapXML before this module. I was unable to see sitemap in any of them, so I guess it's my config who failed. :(

Share this post


Link to post
Share on other sites
Mike Rockett    965
2 hours ago, mel47 said:

Thanks for clarification.

To be honest, I already tried MarkupSitemapXML before this module. I was unable to see sitemap in any of them, so I guess it's my config who failed. :(

You're welcome.

Are you actually redirected to your home page, or does it not redirect but does show the home page?

Share this post


Link to post
Share on other sites
Mike Rockett    965
12 hours ago, mel47 said:

Solved. Found why. Url segments was activated on home template.

Thanks!

Ah, of course. Url segments is something that can't be supported because of how they're created... No easy way to keep track of them.

  • Like 2

Share this post


Link to post
Share on other sites
maxf5    43

Hi Mike, wonderful module for languages and image integration!
But what can i do to fix this case?

<url>
<loc>http://www.xxx.de/</loc>
<lastmod>2017-09-10T00:03:12+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="home" href="http://www.xxx.de/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://www.xxx.de/en/"/>
</url>


Unbenannt.thumb.PNG.05e4315eaab06214e47780e351eef0e9.PNG

Share this post


Link to post
Share on other sites
Mike Rockett    965
7 hours ago, maxf5 said:

Hi Mike, wonderful module for languages and image integration!
But what can i do to fix this case?

<url>
<loc>http://www.xxx.de/</loc>
<lastmod>2017-09-10T00:03:12+02:00</lastmod>
<xhtml:link rel="alternate" hreflang="home" href="http://www.xxx.de/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://www.xxx.de/en/"/>
</url>

@maxf5 - Glad you like it, and thanks for the post. I still need to work better multi-language support. Even at this point on the multi-lang site profile that PW ships with, the first alternate is identifcal to the main URL in terms of what they contain. Yours is a little different, and so I'd need to envisage the possibilities before working on it properly.

Share this post


Link to post
Share on other sites
PWaddict    87

@Mike Rockett There are 3 problems with the module:

1. The iso for the default language as @maxf5 mentioned.
2. Some pages are completely ignored
3. Wrong sitemap markup. Each link must have it's alternate links not just the default one.

I'm currently using the below method for a proper multi-language sitemap.

1st step
Create a php file "sitemap-xml-multilanguage.php" with the below code and add it on /site/templates/ folder.

<?php namespace ProcessWire;

if (!wire('modules')->isInstalled('LanguageSupportPageNames')) throw new WireException('Missing module: LanguageSupportPageNames');

// Exclude pages here
function selectors() {
	$selectors = array(
	'', // E.g. template!=variations
	); 
	return implode(',',$selectors);
}

function renderSitemapPage(Page $page) {
	$out = '';
	foreach (wire('languages') as $lg) {
		if (!$lg->isDefault() && !$page->{"status$lg->id"}) continue;
		$out .= "\n<url>" . 
			"\n\t<loc>" . $page->localHttpUrl($lg) . "</loc>" . 
			renderSitemapAlternateLangs($page) .
			"\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>" . 
			"\n</url>";
	}
	return $out;
}

function renderSitemapChildren(Page $page) { 

	$out = '';
	$newParents = new PageArray(); 
	$children = $page->children(selectors()); 
	
	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 renderSitemapAlternateLangs(Page $page) {
	$out = '';
	foreach(wire('languages') as $lg) {
		if (!$lg->isDefault() && !$page->{"status$lg->id"}) continue;
		$iso = $lg->language_iso_code; // Custom text field for ISO under system's language template
		$out .=	"\n\t<xhtml:link rel=\"alternate\" hreflang=\"$iso\" href=\"".$page->localHttpUrl($lg)."\"/>";
	}
	return $out;
}

function renderSitemapXML(array $paths = array()) {

	$out = 	'<?xml version="1.0" encoding="UTF-8"?><urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd">';

	array_unshift($paths, '/');

	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();

Note: The above code if I remember correctly is based on @ryan and @kixe code.

2nd step
Add the new template "sitemap-xml-multilanguage" in PW and under URLs tab on "Should page URLs end with a slash?" select "No".

3rd step
Create a new page under "Home" with the title "sitemap.xml" by using the "sitemap-xml-multilanguage" template.

Final step
Create a text field with the name "language_iso_code" and add it under system's language template under "Setup > Templates > Show system templates? > Yes. Then on each language under "Setup > Languages" you will have to add the iso name. This is useful for the default language.

Here are the results I'm getting on http://localhost/mysite/sitemap.xml with my method:

<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd">
<url>
<loc>http://localhost/mysite/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/"/>
<lastmod>2017-09-02</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/"/>
<lastmod>2017-09-02</lastmod>
</url>
<url>
<loc>http://localhost/mysite/nea/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/"/>
<lastmod>2017-08-27</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/news/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/"/>
<lastmod>2017-08-27</lastmod>
</url>
<url>
<loc>http://localhost/mysite/parastaseis/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/parastaseis/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/"/>
<lastmod>2017-08-07</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/shows/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/parastaseis/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/"/>
<lastmod>2017-08-07</lastmod>
</url>
<url>
<loc>http://localhost/mysite/omada/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/omada/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/meet-the-team/"/>
<lastmod>2017-08-25</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/meet-the-team/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/omada/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/meet-the-team/"/>
<lastmod>2017-08-25</lastmod>
</url>
<url>
<loc>http://localhost/mysite/epikoinwnia/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/epikoinwnia/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/contact/"/>
<lastmod>2017-09-02</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/contact/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/epikoinwnia/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/contact/"/>
<lastmod>2017-09-02</lastmod>
</url>
<url>
<loc>http://localhost/mysite/nea/test-4/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-4/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-4/"/>
<lastmod>2017-08-14</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/news/test-4/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-4/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-4/"/>
<lastmod>2017-08-14</lastmod>
</url>
<url>
<loc>http://localhost/mysite/nea/test-3/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-3/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-3/"/>
<lastmod>2017-08-11</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/news/test-3/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-3/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-3/"/>
<lastmod>2017-08-11</lastmod>
</url>
<url>
<loc>http://localhost/mysite/nea/test-2/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-2/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-2/"/>
<lastmod>2017-08-11</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/news/test-2/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-2/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-2/"/>
<lastmod>2017-08-11</lastmod>
</url>
<url>
<loc>http://localhost/mysite/nea/test-1/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-1/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-1/"/>
<lastmod>2017-08-11</lastmod>
</url>
<url>
<loc>http://localhost/mysite/en/news/test-1/</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/nea/test-1/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/news/test-1/"/>
<lastmod>2017-08-11</lastmod>
</url>
<url>
<loc>
http://localhost/mysite/parastaseis/test/
</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/parastaseis/test/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/test/"/>
<lastmod>2017-09-04</lastmod>
</url>
<url>
<loc>
http://localhost/mysite/en/shows/test/
</loc>
<xhtml:link rel="alternate" hreflang="el" href="http://localhost/mysite/parastaseis/test/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/test/"/>
<lastmod>2017-09-04</lastmod>
</url>
</urlset>

 

and here are the results from your module:

<urlset xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml" xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd">
<url>
<loc>http://localhost/mysite/</loc>
<lastmod>2017-09-02T05:37:50+03:00</lastmod>
<xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/"/>
</url>
<url>
<loc>http://localhost/mysite/parastaseis/</loc>
<lastmod>2017-08-07T09:51:08+03:00</lastmod>
<xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/parastaseis/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/"/>
</url>
<url>
<loc>
http://localhost/mysite/parastaseis/test/
</loc>
<lastmod>2017-09-04T11:06:36+03:00</lastmod>
<xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/parastaseis/test/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/shows/test/"/>
</url>
<url>
<loc>http://localhost/mysite/omada/</loc>
<lastmod>2017-08-25T20:27:09+03:00</lastmod>
<xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/omada/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/meet-the-team/"/>
</url>
<url>
<loc>http://localhost/mysite/epikoinwnia/</loc>
<lastmod>2017-09-02T04:10:51+03:00</lastmod>
<xhtml:link rel="alternate" hreflang="home" href="http://localhost/mysite/epikoinwnia/"/>
<xhtml:link rel="alternate" hreflang="en" href="http://localhost/mysite/en/contact/"/>
</url>
</urlset>

 

I hope it can help you fix your module.

  • Like 1

Share this post


Link to post
Share on other sites
maxf5    43
Maybe one can make optional module settings for this problem.
Listing every language used on the website and a field for the ISO and a checkbox.
When checked it renders the "custom" ISO for this language.

  • Like 1

Share this post


Link to post
Share on other sites
Mike Rockett    965

@PWaddict - Thanks! I totally missed out on the actual requirements there. Will work on fixes based on your code soon. Note sure why some of those pages are being ignored as I didn't experience that myself... Will look into it.

@maxf5 - After fixes, the module will create a language ISO field and automatically add it to the language template.

  • Like 2

Share this post


Link to post
Share on other sites
psy    150

Wishlist/request... would love to see on a per page/template basis a sitemap priority field.

When no priority is specified, Google goes 'top page - 100%', 'sub page - 80%', 'sub-sub-page - 60%'. 

In reality however, the 'sub-page' is often the parent page in the menu. The 'sub-sub-page' has the guts & glory that you want indexed with a high priority.

Google doesn't guarantee but says it will give a sub-sub-page with a priority eg of 80% a higher priority than it's root parent with a priority of 60%.

https://www.sitemaps.org/protocol.html

  • Like 2

Share this post


Link to post
Share on other sites
Mike Rockett    965

I'm making progress with all the necessary changes. On my dev server (not git-pushed yet), the following is complete:

  1. Languages: Multi-language is sorted. It now renders the sitemap according to Google standards, where a page's <url> is generated for each languages with alternate langs, including current. Method is not the same as above example (page-loop), but expands on the root-first-then-children process - this allows easier flexibility in terms of what we can ignore on a page by page basis.
  2. ISOs: Haven't created the separate language ISO field yet, as my my main concern is regarding names vs ISOs. If they are normally identical, then we would only need to declare a proper ISO name for the default language only when its URL matches the default root URL (ie: default URL root = site root). In this case, perhaps it would be better to simply have a module config entry for the default language only? The rationale behind this is that the language name (other than default) should be the same as the iso (for better SEO practice, I'd guess). I haven't yet bumped into a ProcessWire site that doesn't use the ISO for each language name accordingly. If I'm wrong, please point it out, and then I'll use the iso field, per the above example. Or perhaps I should simple allow the flexibility and have the ISO name fall back to the language name if not provided via a field (the default would still need one if it is root)?
  3. Image-support: Images are now picked up in all languages, given the process-change. If an image field is not specified in another language, it will fall back to the default language. Support for ImageExtra remains.

Priority: not done yet. I'll follow a basic principal with this: if the priority is set on a specific page, then it will be added. Otherwise, the tag will be left out. If this is not the correct methodology, please let me know. (cc @psy)

Note: I still need to do some testing on this...

  • Like 3

Share this post


Link to post
Share on other sites
Mike Rockett    965

Quick questions: Should the module -

  1. ping sitemap engines (after cache-revocation)?
  2. add /sitemap.xml to /robots.text if it exists and is not already added? (This would be done at install-time, and removed at uninstall-time.)

For anyone who may be curious about it, I don't plan on adding XSLT support. End of the day: sitemap.xml is intended for the viewsing of search engines, and not humans. If you want a visual sitemap, best to create your own. :-)

Share this post


Link to post
Share on other sites
psy    150
35 minutes ago, Mike Rockett said:

Priority: not done yet. I'll follow a basic principal with this: if the priority is set on a specific page, then it will be added. Otherwise, the tag will be left out.

The docs say the tag is optional so it sounds right to me. Thanks @Mike Rockett

Share this post


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

ISOs: Haven't created the separate language ISO field yet, as my my main concern is regarding names vs ISOs.

[...]

Just to add to this point, @maxf5's issue can be solved by adding a default-language name to the home page. In LanguageSupportPageNames, the default language URI is the same as it would be without a language, and so it won't show even if the name is set.

Here's the setup I'm using on the built-in language profile:

LanguageSupportPageNames

sitemap01.jpeg.88db4a516cdfe4e81e91d070450186f6.jpeg

Home Page default language name

sitemap02.jpeg.de30965b3f9cc18fa473ef1b86799ba0.jpeg

Sitemap url output

    <url>
        <loc>http://pw-modules.local/</loc>
        <lastmod>2017-09-15T15:35:15+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>

 

  • Like 1

Share this post


Link to post
Share on other sites
PWaddict    87

@Mike Rockett nice "trick"! I don't remember seeing that option on LanguageSupportPageNames. I will definitely gonna use that. I'm currently using the language_iso_code field not only on my sitemap but also on site's navigation (hreflang) and the flag icons but I will delete it :)

  • Like 1

Share this post


Link to post
Share on other sites
Mike Rockett    965
1 hour ago, PWaddict said:

@Mike Rockett nice "trick"! I don't remember seeing that option on LanguageSupportPageNames. I will definitely gonna use that. I'm currently using the language_iso_code field not only on my sitemap but also on site's navigation (hreflang) and the flag icons but I will delete it :)

Indeed it is - and I bumped into how it works by accident. Will be sticking to this method. v0.2 coming out shortly.

Share this post


Link to post
Share on other sites
PWaddict    87
12 minutes ago, Mike Rockett said:

Indeed it is - and I bumped into how it works by accident. Will be sticking to this method. v0.2 coming out shortly.

There is only a small "downside" if the website is already online. All links from the default language (except homepage) will change so the Page Path History module MUST be installed to avoid 404 errors from previously shared pages, google search etc. Make sure to update your README.md with all these important info.

  • Like 1

Share this post


Link to post
Share on other sites
Mike Rockett    965
5 minutes ago, PWaddict said:

There is only a small "downside" if the website is already online. All links from the default language (except homepage) will change so the Page Path History module MUST be installed to avoid 404 errors from previously shared pages, google search etc. Make sure to update your README.md with all these important info.

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.

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 nuel
      hi there
      i'm new to processwire, please cut me some slack if the answer is already out there..
      i am "processwiring" a non-cms page that i made, containing many repeating so called "station"-elements with fields such as date, location, miles, optional links, photo upload etc. they were listed and created via php and stored in an xml file until now:
      <stations> <station> <date>17.8.2017</date> <location>Exil, Zurich</location> <miles>1234</miles> ... </station> <station> ... </station> </stations> i already created a working repeater field with the needed fields and successfully created the first two elements... but there are many more!
      what is the easiest and quickest way to batch create new repeater fields with the node element content of my xml file?
      otherwise i would just have to type the whole sh..t again which i am too damn lazy to do
      thanks in advance
      nuel
    • By OLSA
      Hello for all,
      these days finishing project what is combination of e-commerce and portal website. Problem is "Products" page-tree because content need to be divided inside 48 categories. Also the client gave me content divided in 68 categories, but at the end they accepted my proposal about reducing that number. But problem is that and with 48 categories in backend, "Products" page tree is very large, long list, and very hard for administration. On front-end mega-menu with labels (menu group headings) solved that problem for vistors. And, at the end, I decided to test variant with additional categories to group categories, and result is good (now it's easy for adminsitration to find what they want very easy).
      Problem: now urls are longer, and in some parts (categories) not sure how that's can affect on SEO (eg. before: "products/showers/some-product", now: "products/showers-and-bathtubs/showers/some-product"). There are few more examples like that. And another thing is that urls are now longer (more characters, and deeper).

      For better administration I added new level of categorisation - I think - that is not a way to go. What is your opinion or suggestion about that? Maybe different, custom admin template, with custom navigation, or some folders? or ...?
      Thanks.
    • By Peter Knight
      Had a question about trailing slashes and forcing one or other.
      I've a site where most pages can be accessed with AND without a trailing slash
      IE
      domain.com/about-us/contact
      and
      domain.com/about-us/contact/
      are both accessible and being indexed by Google. It's obviously bad for SEO but I can't seem to make PW respect one and redirect etc.
      There is a setting in templates>template>URLs 
      I must be overlooking something as I have 'yes' selected and both URLs are still reachable with no redirect.
      What do you guys do to counter this?
       
    • By fabjeck
      Hi all, I am new to PW and building up a website for a customer and have some problems with structuring my project:
      On my main.php file I have a main-tag where I wan't to echo the region called 'content'. But the problem is that the markup inside this wrapper should be variable.Example: I have a page where all the news previews are outputed  like in a normal news app--> no additional markup is needed. But on "home" I want to have different sections with content -->
       
      <section>     <div class="slider">         <!--here i want to have some filtered news articles-->     </div> </section> <section> <div class="news">         <!--here i want to have some news articles but with another filter-->     </div> </section>

      How can I realise that? It has to be like that for responsive purposes. 
      Is it maybe possible to create and echo regions inside the "parent region"?

      Cheers and thank you for your help
       
    • By mr-fan
      Just working on some smaller projects and take the step into the actual master/dev version and all the new methods and api chunks that are coming with the 3.x series...
      since i'm not always build websites i'm not always go with the brand new things and put them in my workflow....there is a 24 per day timelimit i think...;)
      BUT actual i dive deep in markup regions....and holy shit this feature ROCKS!
      It should put in place better than in some blogposts:
      http://processwire.com/blog/posts/processwire-3.0.49-introduces-a-new-template-file-strategy/
      http://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/
      or can some admins make a headline in the official docs and link to the blogentries??
      This feature is to important to get missed for beginners and other users of PW!
      I'm just kick my whole workflow and change it for the markup regions....i'm feeling like xmas in summer Thank you @ryan
      Best regards and happy "new" year....