一键导入
gutenberg-block
Create a new Gutenberg block for the Saman SEO plugin. Use when adding editor blocks for schema markup, SEO elements, or content enhancement tools.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new Gutenberg block for the Saman SEO plugin. Use when adding editor blocks for schema markup, SEO elements, or content enhancement tools.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add a new WordPress filter hook to the Saman SEO plugin with proper documentation. Use when making functionality extensible, allowing third-party customization, or adding developer hooks.
Add a new SEO audit metric to the scoring system. Use when extending the SEO analysis, adding new quality checks, or improving the audit dashboard.
Add a new schema.org structured data type to the Saman SEO plugin. Use when adding support for new schema types like Recipe, Event, Product, etc.
Review code changes in the Saman SEO plugin for quality, security, and adherence to WordPress coding standards. Use when reviewing PRs, checking code quality, or before committing changes.
Generate a pull request title and description from the current branch's commits. Produces a concise summary, optional feature highlights, and collapsible technical details.
Create a new React admin page for the Saman SEO plugin dashboard. Use when adding new settings pages, tool interfaces, or admin features that need a UI.
| name | gutenberg-block |
| description | Create a new Gutenberg block for the Saman SEO plugin. Use when adding editor blocks for schema markup, SEO elements, or content enhancement tools. |
Generate a new Gutenberg block for the Saman SEO plugin.
$ARGUMENTS should contain: block name (e.g., "review") and descriptionCreate block directory at blocks/{block-name}/
Create block.json (block metadata):
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "saman-seo/{block-name}",
"version": "1.0.0",
"title": "{Block Title}",
"category": "saman-seo",
"icon": "{dashicon-name}",
"description": "{Block description}",
"keywords": ["{keyword1}", "{keyword2}", "seo"],
"supports": {
"html": false,
"align": ["wide", "full"]
},
"textdomain": "saman-seo",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"render": "file:./render.php",
"attributes": {
"exampleAttribute": {
"type": "string",
"default": ""
}
}
}
/**
* {Block Name} Block
*
* @package Saman SEO
*/
import { registerBlockType } from '@wordpress/blocks';
import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
import { PanelBody, TextControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import metadata from './block.json';
import './editor.scss';
/**
* Edit component for the block.
*/
const Edit = ({ attributes, setAttributes }) => {
const blockProps = useBlockProps();
const { exampleAttribute } = attributes;
return (
<>
<InspectorControls>
<PanelBody title={__('Settings', 'saman-seo')}>
<TextControl
label={__('Example Setting', 'saman-seo')}
value={exampleAttribute}
onChange={(value) => setAttributes({ exampleAttribute: value })}
/>
</PanelBody>
</InspectorControls>
<div {...blockProps}>
{/* Block editor preview */}
<div className="saman-seo-{block-name}">
{/* Content */}
</div>
</div>
</>
);
};
/**
* Save component - returns null for dynamic blocks.
*/
const Save = () => null;
/**
* Register the block.
*/
registerBlockType(metadata.name, {
edit: Edit,
save: Save,
});
<?php
/**
* Server-side rendering of the {Block Name} block.
*
* @package Saman\SEO
*
* @var array $attributes Block attributes.
* @var string $content Block content.
* @var WP_Block $block Block instance.
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$wrapper_attributes = get_block_wrapper_attributes( array(
'class' => 'saman-seo-{block-name}',
) );
// Generate schema if applicable
$schema = array(
'@context' => 'https://schema.org',
'@type' => '{SchemaType}',
// Add schema properties
);
?>
<div <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<!-- Block HTML output -->
</div>
<?php if ( ! empty( $schema ) ) : ?>
<script type="application/ld+json">
<?php echo wp_json_encode( $schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ); ?>
</script>
<?php endif; ?>
/**
* Editor styles for {Block Name} block.
*/
.wp-block-saman-seo-{block-name} {
padding: 20px;
border: 1px solid #ddd;
border-radius: 4px;
background: #f9f9f9;
}
/**
* Frontend styles for {Block Name} block.
*/
.saman-seo-{block-name} {
margin: 1em 0;
padding: 1em;
}
Add to includes/class-saman-seo-plugin.php or create a dedicated service:
add_action( 'init', function() {
register_block_type( SAMAN_SEO_PATH . 'blocks/{block-name}' );
} );
package.json if neededReference existing blocks in blocks/:
blocks/breadcrumbs/ - Navigation breadcrumbs with schemablocks/faq/ - FAQ schema blockblocks/howto/ - How-To schema blockReview / AggregateRatingProductEventRecipeArticle / NewsArticlePersonOrganizationLocalBusinessrender.php for server-side output/gutenberg-block review Star rating and review schema block for products and services