PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.4
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.4
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / schema-templates / recipe.block.php

recipe.block.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.4, at src/schema-templates/recipe.block.php

41 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Recipe block schema template.
4 *
5 * @package Yoast\WP\SEO\Schema_Templates
6 */
7
8 /* translators: %1$s expands to Yoast */
9 $yoast_seo_block_title = sprintf( __( '%1$s Recipe', 'wordpress-seo' ), 'Yoast' );
10
11 $yoast_seo_block_template = [
12 [ 'yoast/recipe-name' ],
13 [ 'yoast/cooking-time' ],
14 [ 'yoast/preparation-time' ],
15 [ 'core/image' ],
16 [ 'yoast/recipe-description' ],
17 [ 'yoast/recipe-ingredients' ],
18 [ 'yoast/recipe-instructions' ],
19 ];
20
21 $yoast_seo_required_blocks = [
22 [ 'name' => 'yoast/recipe-name' ],
23 [ 'name' => 'core/image' ],
24 [ 'name' => 'yoast/recipe-ingredients' ],
25 [ 'name' => 'yoast/recipe-instructions' ],
26 ];
27
28 $yoast_seo_recommended_blocks = [
29 [ 'name' => 'yoast/cooking-time' ],
30 [ 'name' => 'yoast/preparation-time' ],
31 [ 'name' => 'yoast/recipe-description' ],
32 ];
33
34 // phpcs:disable WordPress.Security.EscapeOutput -- Reason: WPSEO_Utils::format_json_encode is safe.
35 ?>
36 {{block name="yoast/recipe" title="<?php echo esc_attr( $yoast_seo_block_title ); ?>" category="yoast-structured-data-blocks" keywords=[ "SEO", "Schema"] description="<?php esc_attr_e( 'Create a Recipe in an SEO-friendly way. You can only use one Recipe block per post.', 'wordpress-seo' ); ?>" supports={"multiple": false} }}
37 {{sidebar-input name="yield" output=false type="number" label="<?php esc_attr_e( 'Serves #', 'wordpress-seo' ); ?>" }}
38 <div class={{class-name}}>
39 {{inner-blocks template=<?php echo WPSEO_Utils::format_json_encode( $yoast_seo_block_template ); ?> required-blocks=<?php echo WPSEO_Utils::format_json_encode( $yoast_seo_required_blocks ); ?> recommended-blocks=<?php echo WPSEO_Utils::format_json_encode( $yoast_seo_recommended_blocks ); ?> appender="button" appenderLabel="<?php esc_attr_e( 'Add a block to your recipe...', 'wordpress-seo' ); ?>" }}
40 </div>
41