• Resolved meideserve

    (@meideserve)


    I have read this webpage on Yoast Schema Graph APi, specification and technicalities:
    https://developer.yoast.com/features/schema/api

    Appreciate the info.

    However, I would like to edit the JSON LD generated by Yoast SEO, because certain JSON LD generated doesn’t fit my requirements (mainly for Google SEO). One important example, is that for breadcrumb hierarchy, I require it to be:

    Home >> Blog >> Category >> Sub-category >> etc >> Post/Article Title.

    I have a lot of blog articles.
    As you can see in this example blog article, https://meide.sg/marble-floor-cleaning-guide, the breadcrumb is missing “Blog”. The JSON LD code generated is:

    
    {
    	            "@type": "BreadcrumbList",
    	            "@id": "https://meide.sg/marble-floor-cleaning-guide/#breadcrumb",
    	            "itemListElement": [
    	                {
    	                    "@type": "ListItem",
    	                    "position": 1,
    	                    "item": {
    	                        "@type": "WebPage",
    	                        "@id": "https://meide.sg/",
    	                        "url": "https://meide.sg/",
    	                        "name": "Home"
    	                    }
    	                },
    	                {
    	                    "@type": "ListItem",
    	                    "position": 2,
    	                    "item": {
    	                        "@type": "WebPage",
    	                        "@id": "https://meide.sg/category/cleaning/",
    	                        "url": "https://meide.sg/category/cleaning/",
    	                        "name": "For Home Owners And Helpers"
    	                    }
    	                },
    	                {
    	                    "@type": "ListItem",
    	                    "position": 3,
    	                    "item": {
    	                        "@type": "WebPage",
    	                        "@id": "https://meide.sg/category/cleaning/floor-cleaning/",
    	                        "url": "https://meide.sg/category/cleaning/floor-cleaning/",
    	                        "name": "Floor Cleaning"
    	                    }
    	                },
    	                {
    	                    "@type": "ListItem",
    	                    "position": 4,
    	                    "item": {
    	                        "@type": "WebPage",
    	                        "@id": "https://meide.sg/marble-floor-cleaning-guide/",
    	                        "url": "https://meide.sg/marble-floor-cleaning-guide/",
    	                        "name": "How To Clean A Marble Floor In 6 Easy Steps"
    	                    }
    	                }
    	            ]
    	        },
    

    How can I do this to solve my problems?
    Problem 1. To fix this breadcrumb problem.
    Problem 2. To be able to edit the json ld code (and not just add/change or remove graph pieces).

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Suwash

    (@suascat_wp)

    @meideserve

    You identified multiple queries in your message and we’ve responded to them below.?

    Problem 1. To fix this breadcrumb problem.

    Is your blog page set as the Posts page at Settings → Reading, in your WordPress dashboard? If so, then you can add it in the breadcrumbs by going to SEO → Search Appearance → Breadcrumbs and select to show the Blog page. Please refer to https://kb.yoast.com/kb/implement-wordpress-seo-breadcrumbs/#enable-and-configure-the-yoast-breadcrumbs for more details.

    Problem 2. To be able to edit the JSON LD code (and not just add/change or remove graph pieces).

    Unfortunately, there’s no other easy way to edit the JSON LD code outputted by our Yoast SEO plugin except via available developer filters.

    Thread Starter meideserve

    (@meideserve)

    Appreciate your help!

    Problem 1: nope, because I have customized the posts page… so i did not set the Settings > Readings > Post Page as ANYthing… i left it blank. Is that advisable?

    I refered to your kb.yoast.com and used this code to manually edit the breadcrumb path, in functions.php. success! yay!

    /*
     * From URL https://gist.github.com/amboutwe/ea0791e184668a5c7bd7bbe357c598e9
     * Add a link to the Yoast SEO breadcrumbs
     * Credit: https://wordpress.stackexchange.com/users/8495/rjb
     * Last Tested: Nov 30 2018 using Yoast SEO 9.2 on WordPress 4.9.8
     *********
     * DIFFERENT POST TYPES
     * Post: Change 123456 to the post ID
     * Page: Change is_single to is_page and 123456 to the page ID
     * Custom Post Type: Change is_single to is_singular and 123456 to the 'post_type_slug'
        Example: is_singular( 'cpt_slug' )
     *********
     * MULTIPLE ITEMS
     * Multiple of the same type can use an array.
        Example: is_single( array( 123456, 234567, 345678 ) )
     * Multiple of different types can repeat the if statement
     */
    /* peter meide edit - add blog to yoast breadcrumbs path */
    add_filter( 'wpseo_breadcrumb_links', 'yoast_seo_breadcrumb_append_link' );
    function yoast_seo_breadcrumb_append_link( $links ) {
        global $post;
    
    /**    if ( is_single ( 123456 ) ) { **/
            $breadcrumb[] = array(
                'url' => site_url( '/blog/' ),
                'text' => 'Blog for Staging15 (test)',
            );
    
            array_splice( $links, 1, -2, $breadcrumb );
    /**    } **/
    
        return $links;
    }
    • This reply was modified 3 years, 8 months ago by meideserve.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Editing Breadcrumb List’ is closed to new replies.