WordPress / pattern-directory

The WordPress Block Pattern Directory
https://wordpress.org/patterns/
GNU General Public License v2.0
119 stars 31 forks source link

Pattern Directory: Add an option to filter by author and author collections #549

Open annezazu opened 1 year ago

annezazu commented 1 year ago

In talking with @elmastudio, she brought up the desire to have the ability to filter patterns by author. This would help in terms of offering both ways of seeing patterns that might go together and in terms of offering collections. More here: https://github.com/WordPress/gutenberg/issues/44611#issuecomment-1396372238

In some cases though, a pattern author might not intentionally have patterns that go together, instead creating one off options. However, when thinking about block themes and interoperability, it does make sense for future mixing and matching to have collections used within a block theme that can be fully snagged for use on a site separate from a theme.

ryelle commented 1 year ago

Authors

It is already possible to view patterns by an author on the pattern directory, for example, patterns by WordPress.org. This view can be found by clicking the author name on a pattern.

author_name is also exposed in the API, so for example, this returns the WordPress.org patterns: https://api.wordpress.org/patterns/1.0/?author_name=wordpressdotorg&locale=en_US. This can be used in the editor (though to use it, the key will need to be added here in GB).

The exception here seems to be search requests, where we encounter this bug again: https://github.com/WordPress/pattern-directory/issues/547

Author collections

Author collections would be harder to manage, because we would probably create them as custom tags and I could see people easily misusing them for keyword spam - they already do that for the open text for pattern descriptions.

Themes can already define a set of patterns used in the theme.json, so that kind of works as a collection in reverse. I see this would be "for use on a site separate from a theme," but I'm not sure why that would be needed?

I'm not against the idea, but I'd like to figure out a way to do it with guardrails against spam.

annezazu commented 1 year ago

It is already possible to view patterns by an author on the pattern directory, for example, patterns by WordPress.org. This view can be found by clicking the author name on a pattern.

Yes! I recognize this is the main way you can view patterns by author. In this case, I think it's a matter of being able to search by author, bundle those, and then perhaps connect them somehow to block themes potentially (in the future).

The exception here seems to be search requests, where we encounter this bug again: https://github.com/WordPress/pattern-directory/issues/547

Noted. Thank you for connecting those dots.

Themes can already define a set of patterns used in the theme.json, so that kind of works as a collection in reverse. I see this would be "for use on a site separate from a theme," but I'm not sure why that would be needed?

In this case, it would be to offer something comparable to things like https://elementor.com/library/template-kit/marketing-studio-website-kit/ or https://webflow.com/templates/html/sulu-portfolio-website-template

sereedmedia commented 1 year ago

I think being able to offer pattern collections make a lot of sense.

What if it wasn't "creating a collection" (another CPT or taxonomy that needs a name) so much as relating individual patterns together? Creating a custom "related pattern" field of sorts? This is something I do often on client sites using "relationship" custom fields.

Then pattern collections wouldn't be available to "search by collection" in the Pattern Directory, but a user could "find all the linked patterns" when viewing a pattern, which would return a query of that related patterns field.