• Hello Team,

    Kindly help me to debug the following issue with web-stories.

    1. “Tag ‘amp-story’ is not allowed to have any sibling tags (‘body’ should only have 1 child).”
    2. “The mandatory tag ‘link rel=canonical’ is missing or incorrect.”

    I have metabox plugin, wp-rocket plugin with updated version.

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Luckyna San

    (@luckynasan)

    @nviews Hello there, thank you for your topic.

    Since you mentioned using WP Rocket could you please check if the minification options for JavaScript/CSS files are enabled? You can find this by going to Settings > WP Rocket > File Optimization and the options will be labelled “Minify CSS files” and “Minify JavaScript files”.

    If it is could you try switching this off and test your stories through the AMP test tool once more?

    Thread Starter Prabakaran Shankar

    (@nviews)

    Hello, thank you very much for your suggestion. I did not enable minification, but now I disabled features like cache options of wp-rocket and Cloudflare, perfmatters -used css, wprocket- (lazy-load, defer-js, delay-js execution), enabled native WordPress canonical attribute to add it to wp-head.

    Still I have the same problems like 1. sibling tag, 2. no canonical tag, 3. < noscript > < /noscript > in < title > tag

    Plugin Support Luckyna San

    (@luckynasan)

    @nviews The error is likely due to a plugin or theme interfering with Web Stories. You can test which could be the culprit by temporarily disabling all other plugins and switching to a default theme. If using a default theme and disabling all other plugins except Web Stories passes the AMP test, we know there is no issue with the plugin.

    Next, activate your theme with Web Stories and retest your story on AMP test too. This will rule out your theme as an issue.

    Then, enable your plugins one by one until you can reproduce the error on AMP test tool and this will identify which plugin is causing the problem.

    Lastly, if you could you provide your Site Health information I can try test on my end to reproduce it as well. You can share privately if you prefer.

    Thread Starter Prabakaran Shankar

    (@nviews)

    Hello,

    I have identified the problem. The problem is in my custom code to optimize the title using the hook ‘pre_get_document_title’.

    function title_meta($title){
        global $post, $page;
    
        ob_start();
        
        if( is_singular() && ! is_singular('web-story') ){
            $_title = rwmb_get_value('_title');
            if( isset( $_title ) && !empty( $_title ) ){
                $title = esc_html( $_title );
            }
          return $title; // this solves the error, but title function is not working
        }
        
        if(is_tag() || is_tax() || is_category() ){ // || is_post_type_archive
            $post_count = $GLOBALS['wp_query']->found_posts;
        	$post_title = get_the_archive_title();
        	$title = esc_html( $post_count ) . ' '. $post_title . esc_html( ' jobs - nViews Career');
        return $title; // this solves the error, but title function is not working
        }
          
        //return $title;  <!-- This creates all the listed issues ->
        return ob_get_clean(); 
    }
    
    add_filter('pre_get_document_title', '_title_meta' );
    Plugin Support Luckyna San

    (@luckynasan)

    @nviews Thanks for the update.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Web stories error – sibling tag, canonical tag’ is closed to new replies.