-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Features: * New block: Knowledge Base Breadcrumbs. * Modifications: * Enhanced breadcrumb navigation with semantic HTML5 markup and improved accessibility * Added Schema.org BreadcrumbList markup for better SEO * Added support for custom Unicode separators in breadcrumbs
- Loading branch information
1 parent
b035623
commit cb192fe
Showing
18 changed files
with
316 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "knowledgebase/breadcrumb", | ||
"version": "2.3.0", | ||
"title": "Knowledge Base Breadcrumb", | ||
"category": "design", | ||
"icon": "menu", | ||
"keywords": [ | ||
"knowledgebase", | ||
"breadcrumb", | ||
"kb", | ||
"navigation" | ||
], | ||
"description": "Display the Knowledge Base Breadcrumb navigation", | ||
"supports": { | ||
"html": false, | ||
"align": true | ||
}, | ||
"attributes": { | ||
"className": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"separator": { | ||
"type": "string", | ||
"default": "»" | ||
} | ||
}, | ||
"example": {}, | ||
"textdomain": "knowledgebase", | ||
"editorScript": "file:./index.js", | ||
"editorStyle": "file:./index.css", | ||
"style": "file:./style-index.css" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n', 'wp-server-side-render'), 'version' => '209f3d829860668efee0'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-i18n', 'wp-server-side-render'), 'version' => 'af27dffe54569e88bed6'); | ||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-i18n', 'wp-server-side-render'), 'version' => 'fdd6590102694fbba66d'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "knowledgebase/breadcrumb", | ||
"version": "2.3.0", | ||
"title": "Knowledge Base Breadcrumb", | ||
"category": "design", | ||
"icon": "menu", | ||
"keywords": ["knowledgebase", "breadcrumb", "kb", "navigation"], | ||
"description": "Display the Knowledge Base Breadcrumb navigation", | ||
"supports": { | ||
"html": false, | ||
"align": true | ||
}, | ||
"attributes": { | ||
"className": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"separator": { | ||
"type": "string", | ||
"default": "»" | ||
} | ||
}, | ||
"example": {}, | ||
"textdomain": "knowledgebase", | ||
"editorScript": "file:./index.js", | ||
"editorStyle": "file:./index.css" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { __ } from '@wordpress/i18n'; | ||
import ServerSideRender from '@wordpress/server-side-render'; | ||
import { useBlockProps, InspectorControls } from '@wordpress/block-editor'; | ||
|
||
import { | ||
Disabled, | ||
PanelBody, | ||
PanelRow, | ||
TextControl, | ||
} from '@wordpress/components'; | ||
|
||
import './editor.scss'; | ||
|
||
export default function Edit({ attributes, setAttributes }) { | ||
const { separator } = attributes; | ||
const blockProps = useBlockProps(); | ||
|
||
return ( | ||
<> | ||
<InspectorControls> | ||
<PanelBody | ||
title={__('Breadcrumb Settings', 'knowledgebase')} | ||
initialOpen={true} | ||
> | ||
<PanelRow> | ||
<TextControl | ||
label={__('Separator', 'knowledgebase')} | ||
value={separator} | ||
onChange={(value) => | ||
setAttributes({ separator: value }) | ||
} | ||
help={__( | ||
'Enter the separator character or Unicode (e.g. »)', | ||
'knowledgebase' | ||
)} | ||
/> | ||
</PanelRow> | ||
</PanelBody> | ||
</InspectorControls> | ||
|
||
<div {...blockProps}> | ||
<Disabled> | ||
<ServerSideRender | ||
block="knowledgebase/breadcrumb" | ||
attributes={attributes} | ||
/> | ||
</Disabled> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.wzkb_breadcrumb { | ||
margin-bottom: 1em; | ||
} | ||
|
||
.wzkb_breadcrumb-list { | ||
list-style: none; | ||
padding: 0; | ||
margin: 0; | ||
display: flex; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
} | ||
|
||
.wzkb_breadcrumb-item { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.wzkb_breadcrumb-item:not(:last-child)::after { | ||
content: "\00BB"; | ||
content: attr(data-separator); | ||
margin: 0 0.5em; | ||
color: var(--wzkb-breadcrumb-separator-color, #666); | ||
} | ||
|
||
.wp-block-knowledgebase-breadcrumb { | ||
margin-bottom: 1em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Registers a new block provided a unique name and an object defining its behavior. | ||
* | ||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ | ||
*/ | ||
import { registerBlockType } from '@wordpress/blocks'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Edit from './edit'; | ||
|
||
/** | ||
* Every block starts by registering a new block type definition. | ||
* | ||
* @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ | ||
*/ | ||
registerBlockType('knowledgebase/breadcrumb', { | ||
/** | ||
* @see ./edit.js | ||
*/ | ||
edit: Edit, | ||
}); |
Oops, something went wrong.