XML Sitemap: verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
 
(32 tussenliggende versies door dezelfde gebruiker niet weergegeven)
Regel 4: Regel 4:
 
# Maak de betreffende site aan als ''property'' binnen ''Google Search Console''
 
# Maak de betreffende site aan als ''property'' binnen ''Google Search Console''
 
# Submit de URL met de sitemap.  
 
# Submit de URL met de sitemap.  
 +
 +
== Robots.txt ==
 +
 +
Incorporate a sitemap in ''robots.txt'' file with syntaxis like this (including the keyword <code>Sitemap: </code>):
 +
 +
<pre>
 +
################################################################################
 +
# Sitemap
 +
################################################################################
 +
#
 +
Sitemap: https://example.com/sitemap_index.xml
 +
</pre>
  
 
== Yoast XML sitemap ==
 
== Yoast XML sitemap ==
  
 
In het geval van Yoast is de sitemap bereikbaar op zoiets als <code>https://example.com/sitemap_index.xml</code>. Deze kun je ook vinden via de interface:
 
In het geval van Yoast is de sitemap bereikbaar op zoiets als <code>https://example.com/sitemap_index.xml</code>. Deze kun je ook vinden via de interface:
 +
 +
In 2019:
  
 
<pre>
 
<pre>
SEO » General - Yoast SEO » Features » XML sitemaps » ? » See the XML sitemap
+
wp-admin » SEO » General - Yoast SEO » Features » XML sitemaps » ? » See the XML sitemap
 
</pre>
 
</pre>
  
== Yoast: Foutmelding witruimte ==
+
In 2023:
  
 +
<pre>
 +
wp-admin » Yoast SEO » Settings » APIs (bottom of page) » XML Sitemaps
 +
</pre>
 +
 +
There are no settings here. What you can do:
 +
 +
* View the XML sitemap
 +
* Link [https://yoa.st/2a-?php_version=8.0&platform=wordpress&platform_version=6.3&software=free&software_version=20.13&days_active=342&user_language=en_US&screen=wpseo_page_settings Learn more]
 +
* Switch to enable or disable sitemaps.
 +
 +
== Yoast: Foutmelding witruimte (juli 2019) ==
 +
 +
=== Het probleem ===
 
{|
 
{|
 
|[[file:20190730-0558.png|thumb|Foutmelding: ''This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error'']]
 
|[[file:20190730-0558.png|thumb|Foutmelding: ''This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error'']]
 
|}
 
|}
 +
 +
=== Mogelijke oorzaken ===
 +
 +
* Witruimte aan het begin of het eind van ''wp-config.php'' en ''functions.php''-bestanden (twee stuks in mijn geval: Hoshi & Hoshi-child
 +
* Plugin of theme die witruimte toevoegt
 +
 +
=== Acties ===
 +
 +
* Alle wp-config- & functions-bestanden gecontroleerd op extra witregels. Dat was een paar keer het geval → Bijgewerkt → Geen verschil
 +
* Theme gewisseld naar ''Hoshi (main)'' - Geen verschil
 +
* Theme gewisseld naar ''Twentynineteen'' - Probleem verdwenen
 +
* Theme gewisseld naar ''Hoshi - Child'' - Probleem komt terug
 +
* Theme gewisseld naar ''Twenty Nineteen'' - Probleem verdwenen
 +
* Theme gewisseld naar ''Hoshi (main)'' - Probleem komt terug → De oorzaak lijkt eerder bij ''Hoshi (Main)'' te liggen dan bij ''Hoshi (Child)''
 +
* <code>wp plugin install health-check</code> [https://kb.yoast.com/kb/how-to-check-for-plugin-conflicts/#plugin]
 +
 +
Troubleshooting mbv. ''Health-check'':
 +
 +
<pre>
 +
Twenty Nineteen  Hoshi-main  Hoshi-child  WooCommerce  Resultaat?
 +
---------------  ----------  -----------  -----------  ----------
 +
---              ---          Aan          Aan          Storing
 +
---              Aan          ---          Aan          Storing
 +
Aan              ---          ---          Aan          Geen storing
 +
---              Aan          ---          ---          Geen storing
 +
---              ---          Aan          ---          Geen storing
 +
</pre>
 +
 +
Conclusies:
 +
 +
* De storing treedt alleen op als ''Hoshi'' (main of child) aanstaan, icm. WooCommerce
 +
* Omdat de storing ook optreedt bij ''Hoshi-main'', ligt het voor de hand om daar als eerste naar de oorzaak te zoeken.
 +
 +
''' Storing binnen Hoshi achterhalen '''
 +
 +
* Hoshi uninstalled (<code>wp plugin hoshi delete</code>)
 +
* Opnieuw geïnstalleerd vanaf originele bestanden (versie 1.7) - Geen storing
 +
 +
Het komt door het bestand:
 +
 +
<pre>
 +
/wp-content/themes/hoshi/framework/modules/woocommerce/load.php
 +
</pre>
 +
 +
De storing wordt veroorzaakt door de laatste include-regel:
 +
 +
<pre>
 +
<?php
 +
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-functions.php';
 +
 +
if(hoshi_mikado_is_woocommerce_installed()) {
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/options-map/map.php';
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-template-hooks.php';
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-config.php';
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/custom-styles/woocommerce.php';
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/widgets/woocommerce-dropdown-cart.php';
 +
}
 +
</pre>
 +
 +
Overigens, dat wil niet zeggen dat het per se hier aan ligt. Misschien is het iets met ''widgets'': De versie van Hoshi die de storing geeft, heeft allerlei widget-directories. De werkende versie niet.
 +
 +
Ik heb het: Die 'oorspronkelijke bestanden' zijn een nieuwere versie dan wat ik gebruikte → Bug is verholpen in nieuwe versie
 +
 +
=== Conclusie ===
 +
 +
* De 'oorspronkelijke bestanden' die ik gebruikte, betroffen versie 1.7. Op de site gebruikte ik versie 1.5, en daar zat het probleem nog in.
 +
 +
=== Oplossingen ===
 +
 +
* Onduidelijke foutmelding? → Gebruik je wel de laatste versie?
 +
 +
== Foutmelding bij updaten Hoshi (juli 2019) ==
 +
 +
Dit is een vervolg op het hoofdstuk hierboven.
 +
 +
=== Het probleem ===
 +
 +
Als ik de installatie van Hoshi ''overload'' met versie 1.7, gaat het sitemap-probleem weg, maar krijg ik een nieuw probleem:
 +
 +
<pre>
 +
Fatal error: Uncaught Error: Call to undefined function hoshi_mikado_get_button_html()
 +
in /var/www/example.com/wp-content/themes/hoshi/framework/modules/woocommerce/woocommerce-template-hooks.php:192
 +
 +
Stack trace:
 +
 +
#0 /var/www/example.com/wp-includes/class-wp-hook.php(288): hoshi_mikado_woocommerce_loop_add_to_cart_link('<a href="/?add-...')
 +
#1 /var/www/example.com/wp-includes/plugin.php(208): WP_Hook->apply_filters('<a href="/?add-...', Array)
 +
#2 /var/www/example.com/wp-content/plugins/woocommerce/templates/loop/add-to-cart.php(32): apply_filters('woocommerce_loo...', '<a href="/?add-...', Object(WC_Product_Simple), Array)
 +
#3 /var/www/example.com/wp-content/plugins/woocommerce/includes/wc-core-functions.php(249): include('/var/www/example.com/...')
 +
#4 /var/www/example.com/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1264): wc_get_template('loop/add-to-car...', Array)
 +
#5 /var/www/example.com/wp-includes/class-wp-hook.php(286): woocommerce_template_loop_add_to_cart(Array)
 +
#6 /var/www/example.com/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', in /var/www/example.com/wp-content/themes/hoshi/framework/modules/woocommerce/woocommerce-template-hooks.php on line 192
 +
</pre>
 +
 +
=== Aanvullende gegevens ===
 +
 +
De ontbrekende functie <code>hoshi_mikado_get_button_html</code> heb ik in een werkende functie kunnen vinden middels <code>grep -rn . -e "hoshi_mikado_get_button_html" | grep "function"</code> (dus zonder haakjes, want daar staan argumenten!). Hij bevindt zich in bestand
 +
 +
/wp-content/themes/hoshi/framework/modules/shortcodes/button/button-functions.php
 +
 +
en die hele map ''shortcodes'' bestaat niet in Versie 1.7.
 +
 +
=== Acties ===
 +
 +
* Oorspronkelijke Hoshi-installatie eerst geplaatst. Daarna 1.7 ''overloaded'' → Foutmelding treedt toch op. Misschien ontbreken nu de benodigde ''include''-commando's → Oude versie teruggezet
 +
 +
=== Oplossing ===
 +
 +
Zie hoofdstuk hiervoor: In bestand
 +
 +
example.com/wp-content/themes/hoshi/framework/modules/woocommerce/load.php
 +
 +
de laatste regel uit-commentariseren:
 +
 +
<pre>
 +
<?php
 +
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-functions.php';
 +
 +
if(hoshi_mikado_is_woocommerce_installed()) {
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/options-map/map.php';
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-template-hooks.php';
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-config.php';
 +
include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/custom-styles/woocommerce.php';
 +
# include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/widgets/woocommerce-dropdown-cart.php';
 +
}
 +
</pre>
 +
 +
Nu doet de site het nog steeds en de XML-sitemap ook. Toch voelt het niet ok:
 +
 +
* Ik gebruik dus een oude versie van Hoshi
 +
* Geen idee wat de gevolgen zijn van het uit-gecommentariseerde commando.
 +
 +
=== Conclusies ===
 +
 +
* Gebruik geen visual designers zoals Hoshi - Altijd ellende & geklooi.
 +
 +
== Include shop pages - Add an external sitemap ==
 +
 +
A site crawl in 2023 of a site with 15,000 products revealed, that half the products were ''orphans''. However, they are linked to from a shop page, like
 +
 +
<pre>
 +
/shop/black-decker/black-decker-sonstiges/page/19/
 +
</pre>
 +
 +
and this page is not included in the XML sitemap. The closest included page, is the associated product_cat taxonomy page:
 +
 +
<pre>
 +
/shop/black-decker/black-decker-sonstiges
 +
</pre>
 +
 +
It is possible to extend the default sitemaps, aka ''adding an external sitemap''. [https://yoast.com/help/add-external-sitemap-to-index/ Yoast documentation even explains how to do this]. The <code>wpseo_sitemap_index</code> filter is introduced for this. [https://gist.github.com/amboutwe/8cfb7a3d8f05e580867341d4ff84141d Example] from Yoast
 +
 +
More (I haven't tried any of these myself):
 +
 +
* https://blog.stefanxo.com/2018/12/how-to-add-a-sitemap-of-your-pod-page-to-wordpress-yoast-seo/
 +
* https://stackoverflow.com/questions/43384351/add-additional-pages-to-wordpress-yoast-seo-sitemap-xml-programatically
 +
* https://gist.github.com/mohandere/4286103ce313d0cd6549
 +
* https://gist.github.com/leepowers/2b32f734571cbeadc811b93501cfcced - Improved upon examples Mohandere & Yoast itself
 +
* https://gist.github.com/leepowers/946d9c72e06779acbb2a125e5b53f475 - Improved upon examples Mohandere & Yoast itself
  
 
== Zie ook ==
 
== Zie ook ==
Regel 25: Regel 213:
 
== Bronnen ==
 
== Bronnen ==
  
 +
* https://yoast.com/help/xml-sitemaps-in-the-wordpress-seo-plugin/
 
* https://www.wpbeginner.com/beginners-guide/what-is-a-wordpress-sitemap-how-to-create-a-sitemap-in-wordpress/
 
* https://www.wpbeginner.com/beginners-guide/what-is-a-wordpress-sitemap-how-to-create-a-sitemap-in-wordpress/
 
* https://blog.hubspot.com/marketing/submit-website-google
 
* https://blog.hubspot.com/marketing/submit-website-google
 
* https://kb.yoast.com/kb/enable-xml-sitemaps-in-the-wordpress-seo-plugin/
 
* https://kb.yoast.com/kb/enable-xml-sitemaps-in-the-wordpress-seo-plugin/
 
* https://support.google.com/webmasters/answer/183668#addsitemap
 
* https://support.google.com/webmasters/answer/183668#addsitemap
 +
 +
''' Foutmelding Yoast '''
 +
 +
* https://wordpress.org/support/topic/sitemap-error-error-on-line-2-at-column-6-xml-declaration-allowed-only-at-the/
 +
* https://kb.yoast.com/kb/xml-sitemap-error/
 +
* https://kb.yoast.com/kb/how-to-check-for-plugin-conflicts/

Huidige versie van 24 jan 2024 om 17:10

Als je tegenwoordig (2019) een site wilt submitten aan Google, wordt je verwacht een XML Sitemap aan te leveren:

  1. Zorg dat je CMS een sitemap aanmaakt. Ik gebruik WordPress, en de Yoast-plugin kan dat prima
  2. Maak de betreffende site aan als property binnen Google Search Console
  3. Submit de URL met de sitemap.

Robots.txt

Incorporate a sitemap in robots.txt file with syntaxis like this (including the keyword Sitemap: ):

################################################################################
# Sitemap
################################################################################
#
Sitemap: https://example.com/sitemap_index.xml

Yoast XML sitemap

In het geval van Yoast is de sitemap bereikbaar op zoiets als https://example.com/sitemap_index.xml. Deze kun je ook vinden via de interface:

In 2019:

wp-admin » SEO » General - Yoast SEO » Features » XML sitemaps » ? » See the XML sitemap

In 2023:

wp-admin » Yoast SEO » Settings » APIs (bottom of page) » XML Sitemaps

There are no settings here. What you can do:

  • View the XML sitemap
  • Link Learn more
  • Switch to enable or disable sitemaps.

Yoast: Foutmelding witruimte (juli 2019)

Het probleem

Foutmelding: This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error

Mogelijke oorzaken

  • Witruimte aan het begin of het eind van wp-config.php en functions.php-bestanden (twee stuks in mijn geval: Hoshi & Hoshi-child
  • Plugin of theme die witruimte toevoegt

Acties

  • Alle wp-config- & functions-bestanden gecontroleerd op extra witregels. Dat was een paar keer het geval → Bijgewerkt → Geen verschil
  • Theme gewisseld naar Hoshi (main) - Geen verschil
  • Theme gewisseld naar Twentynineteen - Probleem verdwenen
  • Theme gewisseld naar Hoshi - Child - Probleem komt terug
  • Theme gewisseld naar Twenty Nineteen - Probleem verdwenen
  • Theme gewisseld naar Hoshi (main) - Probleem komt terug → De oorzaak lijkt eerder bij Hoshi (Main) te liggen dan bij Hoshi (Child)
  • wp plugin install health-check [1]

Troubleshooting mbv. Health-check:

Twenty Nineteen   Hoshi-main   Hoshi-child   WooCommerce   Resultaat?
---------------   ----------   -----------   -----------   ----------
---               ---          Aan           Aan           Storing
---               Aan          ---           Aan           Storing
Aan               ---          ---           Aan           Geen storing
---               Aan          ---           ---           Geen storing
---               ---          Aan           ---           Geen storing

Conclusies:

  • De storing treedt alleen op als Hoshi (main of child) aanstaan, icm. WooCommerce
  • Omdat de storing ook optreedt bij Hoshi-main, ligt het voor de hand om daar als eerste naar de oorzaak te zoeken.

Storing binnen Hoshi achterhalen

  • Hoshi uninstalled (wp plugin hoshi delete)
  • Opnieuw geïnstalleerd vanaf originele bestanden (versie 1.7) - Geen storing

Het komt door het bestand:

/wp-content/themes/hoshi/framework/modules/woocommerce/load.php

De storing wordt veroorzaakt door de laatste include-regel:

<?php

include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-functions.php';

if(hoshi_mikado_is_woocommerce_installed()) {
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/options-map/map.php';
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-template-hooks.php';
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-config.php';
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/custom-styles/woocommerce.php';
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/widgets/woocommerce-dropdown-cart.php'; 
}

Overigens, dat wil niet zeggen dat het per se hier aan ligt. Misschien is het iets met widgets: De versie van Hoshi die de storing geeft, heeft allerlei widget-directories. De werkende versie niet.

Ik heb het: Die 'oorspronkelijke bestanden' zijn een nieuwere versie dan wat ik gebruikte → Bug is verholpen in nieuwe versie

Conclusie

  • De 'oorspronkelijke bestanden' die ik gebruikte, betroffen versie 1.7. Op de site gebruikte ik versie 1.5, en daar zat het probleem nog in.

Oplossingen

  • Onduidelijke foutmelding? → Gebruik je wel de laatste versie?

Foutmelding bij updaten Hoshi (juli 2019)

Dit is een vervolg op het hoofdstuk hierboven.

Het probleem

Als ik de installatie van Hoshi overload met versie 1.7, gaat het sitemap-probleem weg, maar krijg ik een nieuw probleem:

Fatal error: Uncaught Error: Call to undefined function hoshi_mikado_get_button_html() 
in /var/www/example.com/wp-content/themes/hoshi/framework/modules/woocommerce/woocommerce-template-hooks.php:192 

Stack trace: 

 #0 /var/www/example.com/wp-includes/class-wp-hook.php(288): hoshi_mikado_woocommerce_loop_add_to_cart_link('<a href="/?add-...') 
 #1 /var/www/example.com/wp-includes/plugin.php(208): WP_Hook->apply_filters('<a href="/?add-...', Array) 
 #2 /var/www/example.com/wp-content/plugins/woocommerce/templates/loop/add-to-cart.php(32): apply_filters('woocommerce_loo...', '<a href="/?add-...', Object(WC_Product_Simple), Array) 
 #3 /var/www/example.com/wp-content/plugins/woocommerce/includes/wc-core-functions.php(249): include('/var/www/example.com/...') 
 #4 /var/www/example.com/wp-content/plugins/woocommerce/includes/wc-template-functions.php(1264): wc_get_template('loop/add-to-car...', Array) 
 #5 /var/www/example.com/wp-includes/class-wp-hook.php(286): woocommerce_template_loop_add_to_cart(Array) 
 #6 /var/www/example.com/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', in /var/www/example.com/wp-content/themes/hoshi/framework/modules/woocommerce/woocommerce-template-hooks.php on line 192

Aanvullende gegevens

De ontbrekende functie hoshi_mikado_get_button_html heb ik in een werkende functie kunnen vinden middels grep -rn . -e "hoshi_mikado_get_button_html" | grep "function" (dus zonder haakjes, want daar staan argumenten!). Hij bevindt zich in bestand

/wp-content/themes/hoshi/framework/modules/shortcodes/button/button-functions.php

en die hele map shortcodes bestaat niet in Versie 1.7.

Acties

  • Oorspronkelijke Hoshi-installatie eerst geplaatst. Daarna 1.7 overloaded → Foutmelding treedt toch op. Misschien ontbreken nu de benodigde include-commando's → Oude versie teruggezet

Oplossing

Zie hoofdstuk hiervoor: In bestand

example.com/wp-content/themes/hoshi/framework/modules/woocommerce/load.php

de laatste regel uit-commentariseren:

<?php

include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-functions.php';

if(hoshi_mikado_is_woocommerce_installed()) {
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/options-map/map.php';
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-template-hooks.php';
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/woocommerce-config.php';
	include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/custom-styles/woocommerce.php';
	# include_once MIKADO_FRAMEWORK_MODULES_ROOT_DIR.'/woocommerce/widgets/woocommerce-dropdown-cart.php';
}

Nu doet de site het nog steeds en de XML-sitemap ook. Toch voelt het niet ok:

  • Ik gebruik dus een oude versie van Hoshi
  • Geen idee wat de gevolgen zijn van het uit-gecommentariseerde commando.

Conclusies

  • Gebruik geen visual designers zoals Hoshi - Altijd ellende & geklooi.

Include shop pages - Add an external sitemap

A site crawl in 2023 of a site with 15,000 products revealed, that half the products were orphans. However, they are linked to from a shop page, like

/shop/black-decker/black-decker-sonstiges/page/19/

and this page is not included in the XML sitemap. The closest included page, is the associated product_cat taxonomy page:

/shop/black-decker/black-decker-sonstiges

It is possible to extend the default sitemaps, aka adding an external sitemap. Yoast documentation even explains how to do this. The wpseo_sitemap_index filter is introduced for this. Example from Yoast

More (I haven't tried any of these myself):

Zie ook

Bronnen

Foutmelding Yoast