Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keywords to various blocks for easier discovery. #2336

Merged
merged 3 commits into from
Aug 10, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion blocks/library/embed/index.js
Expand Up @@ -26,14 +26,16 @@ const { children } = source;
// These embeds do not work in sandboxes
const HOSTS_NO_PREVIEWS = [ 'facebook.com' ];

function getEmbedBlockSettings( { title, icon, category = 'embed', transforms } ) {
function getEmbedBlockSettings( { title, icon, category = 'embed', transforms, keywords = [] } ) {
return {
title: __( title ),

icon,

category,

keywords,

attributes: {
url: {
type: 'string',
Expand Down Expand Up @@ -253,13 +255,15 @@ registerBlockType(
getEmbedBlockSettings( {
title: 'Twitter',
icon: 'twitter',
keywords: [ __( 'tweet' ) ],
} )
);
registerBlockType(
'core-embed/youtube',
getEmbedBlockSettings( {
title: 'YouTube',
icon: 'video-alt3',
keywords: [ __( 'music' ), __( 'video' ) ],
} )
);
registerBlockType(
Expand All @@ -274,41 +278,47 @@ registerBlockType(
getEmbedBlockSettings( {
title: 'Instagram',
icon: 'camera',
keywords: [ __( 'image' ) ],
} )
);
registerBlockType(
'core-embed/wordpress',
getEmbedBlockSettings( {
title: 'WordPress',
icon: 'wordpress',
keywords: [ __( 'post' ), __( 'blog' ) ],
} )
);
registerBlockType(
'core-embed/soundcloud',
getEmbedBlockSettings( {
title: 'SoundCloud',
icon: 'format-audio',
keywords: [ __( 'music' ), __( 'audio' ) ],
} )
);
registerBlockType(
'core-embed/spotify',
getEmbedBlockSettings( {
title: 'Spotify',
icon: 'format-audio',
keywords: [ __( 'music' ), __( 'audio' ) ],
} )
);
registerBlockType(
'core-embed/flickr',
getEmbedBlockSettings( {
title: 'Flickr',
icon: 'format-image',
keywords: [ __( 'image' ) ],
} )
);
registerBlockType(
'core-embed/vimeo',
getEmbedBlockSettings( {
title: 'Vimeo',
icon: 'video-alt3',
keywords: [ __( 'video' ) ],
} )
);

Expand Down Expand Up @@ -387,6 +397,7 @@ registerBlockType(
getEmbedBlockSettings( {
title: 'Mixcloud',
icon: 'format-audio',
keywords: [ __( 'music' ), __( 'audio' ) ],
} )
);
registerBlockType(
Expand Down Expand Up @@ -471,6 +482,7 @@ registerBlockType(
getEmbedBlockSettings( {
title: 'VideoPress',
icon: 'video-alt3',
keywords: [ __( 'video' ) ],
} )
);
registerBlockType(
Expand Down
1 change: 1 addition & 0 deletions blocks/library/gallery/index.js
Expand Up @@ -66,6 +66,7 @@ registerBlockType( 'core/gallery', {
title: __( 'Gallery' ),
icon: 'format-gallery',
category: 'common',
keywords: [ __( 'image' ) ],

attributes: {
align: {
Expand Down
2 changes: 2 additions & 0 deletions blocks/library/heading/index.js
Expand Up @@ -25,6 +25,8 @@ registerBlockType( 'core/heading', {

category: 'common',

keywords: [ __( 'title' ), __( 'subtitle' ) ],

className: false,

attributes: {
Expand Down
2 changes: 2 additions & 0 deletions blocks/library/latest-posts/index.js
Expand Up @@ -33,6 +33,8 @@ registerBlockType( 'core/latest-posts', {

category: 'widgets',

keywords: [ __( 'recent-posts' ) ],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about this, why did you use recent-posts instead of recent posts

Copy link
Member Author

@mtias mtias Aug 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought spaces wouldn't work, otherwise 'recent posts' would signal you can do 'tagA tagB tagC ... tagN' and circumvent the 3 keywords max :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you search for tagB it won't work. but it's the same if it was tagA-tagB

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, kind of pointless.


attributes: {
postsToShow: {
type: 'number',
Expand Down
1 change: 1 addition & 0 deletions blocks/library/list/index.js
Expand Up @@ -72,6 +72,7 @@ registerBlockType( 'core/list', {
title: __( 'List' ),
icon: 'editor-ul',
category: 'common',
keywords: [ __( 'bullets' ), __( 'ordered-list' ), __( 'numbered-list' ) ],

attributes: {
nodeName: {
Expand Down
2 changes: 2 additions & 0 deletions blocks/library/separator/index.js
Expand Up @@ -16,6 +16,8 @@ registerBlockType( 'core/separator', {

category: 'layout',

keywords: [ __( 'horizontal-line' ), 'hr', __( 'divider' ) ],

transforms: {
from: [
{
Expand Down