Slugs & permalinks (WordPress)

Uit De Vliegende Brigade
(Doorverwezen vanaf SEF URL's)
Naar navigatie springen Naar zoeken springen
Ik denk dat de verwarring (althans, voor mij) tussen slugs en permalinks voortkomt uit het feit dat WordPress de termen door elkaar gebruikt: Dit betreft een WooCommerce-product met bovenaan het veld permalink. Dit moet echter slug zijn - Denk ik. Als je dit veld aanpast, vind je de wijziging terug in wp_posts.post-name, en is dus een slug

Permalinks zijn de default URL's voor posts (inclusief afbeeldingen). Slugs zijn aangepaste/geoptimaliseerde URL's voor de posts. Beiden hebben hun functie.

Permalinks

[1]:

Permalinks are the permanent URLs of your posts, pages,
categories, and other archive pages on your website.
These URLs are permanent and should never be changed — 
hence the name permalink.

Permalinks help to create a URL structure that is easy
for both humans and search engines to understand and share.

* A permalink is used when another blogger wants to
  link to your article.
* You share the permalink when you want to share
  your content on social media. 
* When Google wants to index your article, they use
  the permalink of the content. 
* When you want to share a blog post with your friend,
  you send the permalink of your content in an email.
  • Als je de permalink van een post in een browser opgeeft, wordt je doorgestuurd naar de eventuele slug
  • De structuur voor permalinks kun je specificeren via wp-admin » Settings » permalinks. Ik geloof dat de individuele permalinks van sites nergens worden opgeslagen in de database, maar dynamisch worden aangemaakt wanneer ze nodig zijn.

Slugs

Slugs zijn aangepaste/geoptimaliseerde URL's voor posts. Ze worden standaard afgeleid van de titel van een post. Slugs worden doorgaans gebruikt voor tekstoptimalisatie voor SEO en voor gebruikers.

  • WordPress-slugs zijn altijd onderkast
  • Standaard worden gewone streepjes gebruikt. Geen liggende streepjes
  • Slugs worden opgeslagen in wp_posts.post_name.

Regenerate slugs

You can renegerate slugs through the WP-CLI function wp post update <id> --post_name="".

Zie ook

Bronnen