Yoast - Automatisering: verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
 
Regel 50: Regel 50:
 
== Databasemodel ==
 
== Databasemodel ==
  
Kennis van het databasemodel van een plugin is vaak handig om te achterhalen waar iets wordt bijgehouden en hoe dat te automatisering. Voor het daadwerkelijke automatiseren, is het vaak een stuk minder interessant (voorbeeld: Taxonomieën).
+
See [[Yoast - Database model]].
 
 
Yoast voegt zes tabellen toe aan de wp-database:
 
 
 
* <code>wp_yoast_indexable</code>
 
* <code>wp_yoast_indexable_hierarchy</code>: Een tabel met cijfertjes. Vermoedelijk om hiërarchie tussen rijen in wp_yoast_indexable aan te geven. Verder niet interessant
 
* <code>wp_yoast_migrations</code>: Lijkt betrekking te hebben op Yoast-upgrades. Verder niet interessant
 
* <code>wp_yoast_primary_term</code>: Lijst met associaties tussen posts en bijbehorende primaire taxonomie & taxon
 
* <code>wp_yoast_seo_links</code>: Tabel met maar 51 regels en geen producten
 
* <code>wp_yoast_meta</code>: Tabel waarbij lijkt te worden bijgehouden hoeveel interne en externe links er per post zijn.
 
 
 
Verder maakt Yoast gebruik van in ieder geval de volgende bestaande tabellen:
 
 
 
* <code>wp_options</code> → Apart hoofdstuk
 
* <code>wp_post_meta</code>
 
  
 
== WP-CLI ==
 
== WP-CLI ==

Huidige versie van 17 sep 2022 om 10:36

Alles rondom automatisering van Yoast. Oftewel: beheer van Yoast buiten de web-interface om.

Context van dit artikel (2021.08):

  • Uitsluitend de gratis variant van Yoast
  • Een handjevol WooCommerce-webwinkels met elk duizenden artikelen, in verschillende talen
  • Commando's betreffen WP-CLI, niet PHP.

Yoast-objecten & locaties

Search appearance settings

  • Site: wp-admin » SEO » Search Appearance
  • Inclusief de standaard-waardes voor de diverse Yoast-velden zoals SEO titles en meta descriptions.
  • Database: Tabel wp_options - Field wpseo_titles
  • Beheer WP-CLI: wp option. Bv. wp option get wpseo_titles.

Voorbeeld (deel van de uitvoer):

$ wp option get wpseo_titles

array (
  'forcerewritetitle' => false,
  'separator' => 'sc-dash',
  'title-home-wpseo' => '%%sitename%% %%page%% %%sep%% %%sitedesc%%',
  'title-author-wpseo' => '%%name%%, Author at %%sitename%% %%page%%',
  'title-archive-wpseo' => '%%date%% %%page%% %%sep%% %%sitename%%',
  'title-search-wpseo' => 'Je zocht naar %%searchphrase%% %%page%% %%sep%% %%sitename%%',
  'title-404-wpseo' => 'Pagina niet gevonden %%sep%% %%sitename%%',
  'social-title-author-wpseo' => '%%name%%',
  'social-title-archive-wpseo' => '%%date%%',
  'social-description-author-wpseo' => '%%excerpt%%',
  'social-description-archive-wpseo' => '%%excerpt%%',
  'social-image-url-author-wpseo' => '',
  'social-image-url-archive-wpseo' => '',
  'social-image-id-author-wpseo' => 0,
  'social-image-id-archive-wpseo' => 0,
  ...

Casus: Vertaalde site - 2021.08

Dit betreft een site die geklooned en vertaald is, van voorbeeld.nl naar example.com. Ook de product_cat- & attribute-taxonomieën zijn vertaald:

  • wp option get wpseo_titles toont echter nog steeds de oude attribuut-namen (bv. metadesc-tax-pa_model)
  • Op database-niveau zijn de namen van de attribuut-taxonomieën écht vertaald (SELECT distinct taxonomy FROM en_s1.wp_term_taxonomy;): Dat gebeurt vanzelf als je via wp-admin de namen van taxonomieën aanpast. Toevallig speelt dat niet voor attribuut-taxonomie Model: Da's hetzelfde in NL en EN
  • wp-admin » Products » Attributes » Een model-taxon » Yoast SEO » Meta description: Hier staat dezelfde standaard NL-tekst die ik via wp option get wpseo_titles vond

Databasemodel

See Yoast - Database model.

WP-CLI

Een impressie van WP-CLI-commando's rondom Yoast:

  • wp yoast index: Yoast biedt slechts één WP-CLI commando: Om de index op te bouwen. Ik heb de indruk dat het niet werkt: Het was instantaan klaar, terwijl de webinterface er uren over lijkt te doen - Misschien snap ik iets niet
  • wp option: Om entries in tabel wp_options te beren → Zie elders voor details.

wp options

Enige algemene instellingen lijken te worden bijgehouden in wp_options. custom_taxonomy_slugs lijkt het enige relevante onderdeel hiervan te zijn tav. klonen & vertalen. Wordt dit niet bijgewerkt als je de Yoast-index bijwerkt?

# Overzicht van alle velden:
#
$ wp option list --field=option_name | grep -E -- 'yoast|wpseo'

wpseo
wpseo_titles
wpseo_social
wpseo_flush_rewrite
wpseo_taxonomy_meta
yoast_migrations_free
wpseo_ryte

wpseo

Impressie:

$ wp option get wpseo

array (
  'tracking' => false,
  'license_server_version' => '2',
  'ms_defaults_set' => false,
  'ignore_search_engines_discouraged_notice' => false,
  'indexing_first_time' => false,
  'indexing_started' => 1626764628,
  'indexing_reason' => 'permalink_settings_changed',
  'indexables_indexing_completed' => true,
  'version' => '16.8',
  'previous_version' => '16.7',
  'disableadvanced_meta' => true,
  'enable_headless_rest_endpoints' => true,
  'ryte_indexability' => true,
  'baiduverify' => '',
  'googleverify' => '',
  'msverify' => '',
  'yandexverify' => '',
  'site_type' => 'shop',
  'has_multiple_authors' => false,
  'environment_type' => 'production',
  'content_analysis_active' => true,
  'keyword_analysis_active' => true,
  'enable_admin_bar_menu' => true,
  'enable_cornerstone_content' => true,
  'enable_xml_sitemap' => true,
  'enable_text_link_counter' => true,
  'show_onboarding_notice' => false,
  'first_activated_on' => 1559309841,
  'myyoast-oauth' => false,
  'semrush_integration_active' => true,
  'semrush_tokens' => 
  array (
  ),
  'semrush_country_code' => 'us',
  'permalink_structure' => '/%postname%/',
  'home_url' => 'http://en.s1',
  'dynamic_permalinks' => false,
  'category_base_url' => '',
  'tag_base_url' => '',
  'custom_taxonomy_slugs' => 
  array (
    'product_type' => 'product_type',
    'product_visibility' => 'product_visibility',
    'product_cat' => 'shop',
    'product_tag' => 'product-tag',
    'product_shipping_class' => 'product_shipping_class',
    'pa_example' => '/example',
    ...
    'pa_example_100' => '/example_100',
  ),
  'enable_enhanced_slack_sharing' => true,
  'zapier_integration_active' => true,
  'zapier_subscription' => 
  array (
  ),
  'zapier_api_key' => '',
  'enable_metabox_insights' => true,
  'enable_link_suggestions' => true,
  'algolia_integration_active' => false,
)

wpseo_titles

Een impressie (dit is een paar A4-tjes bij elkaar):

$ wp option get wpseo_titles

array (
  'forcerewritetitle' => false,
  'separator' => 'sc-dash',
  'title-home-wpseo' => '%%sitename%% %%page%% %%sep%% %%sitedesc%%',
  'title-author-wpseo' => '%%name%%, Author at %%sitename%% %%page%%',
  'title-archive-wpseo' => '%%date%% %%page%% %%sep%% %%sitename%%',
  'title-search-wpseo' => 'Je zocht naar %%searchphrase%% %%page%% %%sep%% %%sitename%%',
  'title-404-wpseo' => 'Pagina niet gevonden %%sep%% %%sitename%%',
  'social-title-author-wpseo' => '%%name%%',
  'social-title-archive-wpseo' => '%%date%%',
  'social-description-author-wpseo' => '%%excerpt%%',
  'social-description-archive-wpseo' => '%%excerpt%%',
  'social-image-url-author-wpseo' => '',
  'social-image-url-archive-wpseo' => '',
  'social-image-id-author-wpseo' => 0,
  'social-image-id-archive-wpseo' => 0,
  ...

wp post meta

Een aantal velden worden bijgehouden als wp post meta-velden. Oftewel regels in tabel wp_post_meta.

Voorbeeld (dit betreft een WooCommerce-product):

$ wp post meta list 55272

+---------+----------------------------------+-----------------------------------------------------------------------+
| post_id | meta_key                         | meta_value                                                            |
+---------+----------------------------------+-----------------------------------------------------------------------+
| 55272   | _sku                             | ca-123                                                                |
| 55272   | _regular_price                   | 79.95                                                                 |
| 55272   | total_sales                      | 6                                                                     |
| 55272   | _tax_status                      | taxable                                                               |
| 55272   | _tax_class                       |                                                                       |
| 55272   | _manage_stock                    | no                                                                    |
| 55272   | _backorders                      | no                                                                    |
| 55272   | _sold_individually               | no                                                                    |
| 55272   | _virtual                         | no                                                                    |
| 55272   | _downloadable                    | no                                                                    |
| 55272   | _download_limit                  | -1                                                                    |
| 55272   | _download_expiry                 | -1                                                                    |
| 55272   | _thumbnail_id                    | 53057                                                                 |
| 55272   | _stock                           |                                                                       |
| 55272   | _stock_status                    | instock                                                               |
| 55272   | _wc_average_rating               | 0                                                                     |
| 55272   | _wc_review_count                 | 0                                                                     |
| 55272   | _product_attributes              | <weggehaald>                                                          |
| 55272   | _product_version                 | 4.4.1                                                                 |
| 55272   | _price                           | 79.95                                                                 |
| 55272   | sku_oem                          | 3775                                                                  |
| 55272   | _sku_oem                         | field_5cc47ea230d51                                                   |
| 55272   | diagram                          |                                                                       |
| 55272   | _diagram                         | field_5cc58bd920d9b                                                   |
| 55272   | post_tools                       |                                                                       |
| 55272   | _post_tools                      | field_5ce5246bc13fe                                                   |
| 55272   | _yoast_wpseo_focuskw             | Widgets voor Zbigniew                                                 |
| 55272   | _yoast_wpseo_linkdex             | 28                                                                    |
| 55272   | _yoast_wpseo_content_score       | 60                                                                    |
| 55272   | _yoast_wpseo_primary_product_cat | 44352                                                                 |
| 55272   | dhlpwc_enable_method_limit       |                                                                       |
| 55272   | dhlpwc_selected_method_limit     |                                                                       |
| 55272   | _edit_lock                       | 1627985827:4                                                          |
| 55272   | _edit_last                       | 9                                                                     |
| 55272   | _last_editor_used_jetpack        | classic-editor                                                        |
+---------+----------------------------------+-----------------------------------------------------------------------+

Dit lijken alle Yoast-velden bij elkaar te zijn:

  • _yoast_wpseo_focuskw
  • _yoast_wpseo_linkdex
  • _yoast_wpseo_metadesc
  • _yoast_wpseo_content_score
  • _yoast_wpseo_primary_product_cat.

Hiervan zijn alleen deze beschrijfbaar:

  • _yoast_wpseo_focuskw
  • _yoast_wpseo_metadesc.

Ik weet niet wat _yoast_wpseo_primary_product_cat is.

Tabel wp_yoast_indexable

Een handjevol van de velden:

Veld Opmerkingen
object_id Foreign key: Object waar deze regel betrekking op heeft. Doorgaans hetzelfde als ID in tabel wp_posts
breadcrumb_title Misschien wel precies wat het zegt: Hoe deze pagina verschijnt in het broodkruimelpad
canonical ?
permalink ?
primary_focus_keyword De focus keyphrase in Yoast-secties van pagina's
title ?
description Meta description in de Yoast-sectie van een pagina

Zie ook

Bronnen