• Resolved Jeffinho2016

    (@jeffinho2016)


    Hi,
    Some of us use the trick to put a dot “.” in the “Category base” option of the permalink settings to get rid of the category base in the URL.
    Perhaps it would be possible for yoast to detect if there’s such thing as this dot in the options to prevent outputing an url such as site.com/./my_article/ in the schema?

    • This topic was modified 3 years, 9 months ago by Jeffinho2016.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello,

    Thanks for reaching out. Instead of using the dot ‘.’ to replace the category base, have you considered the feature in the plugin to remove the categories prefix? Category URLs in WordPress contain a prefix, usually /category/, this feature removes that prefix, for categories only. You can find it in WordPress > SEO > Search Appearance > Taxononmies > Category URLs.

    Thread Starter Jeffinho2016

    (@jeffinho2016)

    I did try it, but it led to other issues, which is why I (and many others I believe) opt for the dot “.” in the category base.
    I have this code below which works just fine, I just thought that yoast could implement it for people who uses that solution.

    remove_dot_yoast_schema_breakcrumb_urls($data)
    {
        if (is_singular('post')){
            foreach ($data['itemListElement'] as $key => $crumbData){
                if (isset($data['itemListElement'][$key]['item'])) {
                    $data['itemListElement'][$key]['item']=str_replace('/./','/',$data['itemListElement'][$key]['item']);
                }
            }
        }
        return $data;
    }
    add_filter('wpseo_schema_breadcrumb', 'remove_dot_yoast_schema_breakcrumb_urls');
    Plugin Support Maybellyne

    (@maybellyne)

    Thanks for sharing. We will pass it along.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Breadcrumb urls without category base’ is closed to new replies.