-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Starter Page Templates #18055
Comments
It's a very nice feature and it worths the try 👍. |
@retrofox thanks for the tip. We don’t plan to use live previews for now, just a modal when the user picks a template. Did you identify what made the previews slow? |
Not completely sure why it happens and but it takes the same time to render the blocks into the Editor if I'm not wrong. We're talking about ~2 or ~3 seconds per template depending on how many blocks it has. The problem gets evidence when you have fifteen templates, and twenty-five blocks per each one for instance. Preview all of them increase the time which the process takes. |
Just wanted to note that as @jffng and I have been experimenting with the block-based theme spec over in the I recently rebuilt the Gutenberg Starter theme to use the new block-templates structure. I'd like to bundle an example layout with it. My first thought was to bundle this as starter content. This works, but starter content code is a little unwieldy, since it's full of post-content HTML inside of php. Twenty Twenty's Starter content is a good example of this. To get around that, I thought I'd just have the starter content reference the demo layout as a block template part. This works, but it has two downsides: First, when a user goes to edit the page, the content isn't really there. It's just pulled in from a the file (and currently only displayed with a placeholder, though I know that will change). What I really want is for the content to be imported into the post. The second (and more major) downside is just an inherent problem with starter content: it can really only be pulled in once, when the site is fresh. This would be much better suited to a "page Template", as described in this ticket. I've been digging around for documentation on adding new templates, but I haven't found anything yet... is it possible for themes to include these at this point? I can see these being really helpful in cases where a theme wants to include some pre-built page layouts to the user. |
I also wonder if this could be conceived of as a part of the template creation flow being discussed in #19254 |
CC @dwolfe since this relates to the mosaic view. |
It appears the UI for displaying the theme templates and generic layout templates is being explored here: #19254 especially with this comment. Should this issue also remain open? |
@mapk I think so because I'll be exploring the templates themselves here in detail. It'll help focus conversations. |
I want to mention that semantics around "template" can be weird.
I believe that the "template selector" outlined in the post refers to different options for default page content. E.g. you have several different options to select from for "about pages" or "contact pages". Selecting an option just changes the I like mentioning these semantics when I see conversations about "templates", because it's very easy to mean different things when we say "template" :) |
Is this view with selectable core templates (as compared to files in themes) being considered for the 5.8 MVP? |
I'd like to provide an update on how the Starter template flow currently works from the original post. The update UI now follows this flow and sits outside of the Gutenberg Codebase on Mobile and each of the provided templates now includes a live demo URL providing previews of the pages. The templates are currently pulled from a WordPress.com API however we do have them segmented to provide an endpoint that would be WordPress.org specific. I'll do a brief backscroll and trying to answer some of the more recent questions to the best of my understanding.
The updated UI has been released and the "Starter Page Template" buttons were released briefly but then updated and removed from the mobile UI around Oct/Nov of 2020. We don't currently have a mechanism for theme developers to add to the starter content but I do like that concept and would be in favor of exploring how we could make that happen if that's of interest.
That is correct the feature in Mobile is about prepopulating the content of the page. Thanks for adding that clarity 👍 |
I've also heard ideas about calling this feature "page patterns," similar to block patterns but for a whole page. I personally think it's a nice distinction from templates. |
@koke I think this would be soo useful to have in the core. I created 2 FSE themes so far and also our latest premium theme is made with block patterns and this is exactly what I thought and talked with few people about. It would be great when a user opens a new page, to chose design/page patterns however we called it and it starts editing it right away. Most of the users just want to add a page, choose a layout and start adding their content. |
@anarieldesign Thanks for following up with that suggestion ❤️ FYI @koke is currently working on other projects but I'm leading a team that is focused on these Page Patterns/Layouts and will take this request to be reviewed. |
@chipsnyder that would be great :). Thank you. I'm sure this would be very useful to other theme authors and especially to the users, which's most important. I wanted to open a ticket and suggest if we could make something similar that WordPress.com did but @annezazu shared this ticket with me and so happy you already thought about it. From the user perspective, I think this would be a huge help. Just by opening a new page, having a modal window to choose a design and start to edit it right away is a big step 👍 |
Slack brought me here - full page layouts I think is a fantastic idea - that would greatly enhance the usability of blocks. |
Related: #19907 |
I think we did implement starter templates recently in the site editor. Should we be closing this issue @jorgefilipecosta ? |
I'm closing this old issue now, let's consider a new issue if there are missing things to the starter templates feature. |
@youknowriad i don't see starter templates anywhere in the 6.3 release can you please let me know where or how starter templates are used |
@youknowriad I read this issue as being about having starter templates for posts in the block editor (not the site editor). Like @digamber89, I'm not aware of a feature that allows that. |
In the site editor we have StartTemplateOptions and in the page editor we have StartPageOptions I'm not entirely sure about the heuristics about how to trigger these modals. I think it's related to the presence of "block patterns" that have some flags in the registration. We may be missing some documentation. @jorgefilipecosta might know more. |
Hi @digamber89 and @mrwweb, as mentioned by @youknowriad, we already have the possibility to have pattterns as a starting point for any post or template.
Regarding having a starting point for templates, the pattern needs to define the templateTypes where it can be utilized as the starting content:
This is documented at https://github.com/WordPress/gutenberg/blob/trunk/docs/how-to-guides/curating-the-editor-experience.md#utilizing-patterns. |
My thinking wasn't that a pattern would be a starter content. But that users could select predefined pages or pre-build pages. So that they could add the page change the content and continue. Many plugins and themes do this now but in different guises That way users would be quickly be able to pick and choose different options that a theme developer has envisioned their patterns to be used as. |
@jorgefilipecosta Wow! This is awesome. Thank you for the clarification. I thought I followed these things, but I had missed this. I can confirm that either of these will result in a modal pattern selector for a post type. As a file header in the <?php
/**
* Title: Pattern Name
* Slug: prefix/pattern-slug
* Post Types: post_type_slug
* Block Types: core/post-content
* Template Types: single
*/
?> Registering via PHP: register_block_pattern(
'prefix/pattern-slug',
[
'title' => __( 'Pattern Name', 'textdomain' ),
'blockTypes' => [ 'core/post-content' ],
'postTypes' => [ 'post_type_slug' ],
'templateTypes' => [ 'single' ],
'content' => '',
]
); One potential gotcha: I had previously registered this post type with a Given this, I think closing makes total sense. I appreciate the pointer in the right direction! |
We are building a template selector for new pages created on the mobile apps. We have already started working on our first version, but I think this could be an interesting feature not just for mobile, but for core as well.
Earlier this year, WordPress.com developed and launched a similar feature, via the full-site-editing plugin (There’s a good walkthrough of the broader project and lessons learned in this comment).
I believe this feature makes sense in Gutenberg/core, and would allow third parties to then offer more templates as an added value.
What we are building on mobile
We are trying to start simple to see if the feature is useful to our users and continue from there.
User flows
Designs by @iamthomasbishop:
Phase 1 MVP (milestone)
When a new page is created:
Phase 2
In this stage, we expect to have enough supported blocks to have a better offering of available templates.
Phase 3
In this stage, we complete the set of existing templates in WordPress.com and set up the necessary systems to keep them in sync.
What this could be in core
I think the main idea of the feature would remain the same. Larger screens would benefit from a different UX, since there is enough room to show a preview alongside the templates list.
But more important than UX, I think the bulk of the extra work for core is making this extensible. We would need new API endpoints to expose these templates. We would need hooks for themes and plugins to define their own templates.
We also need to see how this feature fits in all the existing “template” features:
In our MVP I started with About and Contact because they feel the most universal of all templates, but this requires more thought and discussion, as I'm not sure what's the right balance for a set of templates bundled by core.
The text was updated successfully, but these errors were encountered: