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 Ambitious theme to Theme Experiments #21

Merged
merged 1 commit into from
Feb 20, 2020

Conversation

Netzberufler
Copy link
Contributor

@Netzberufler Netzberufler commented Feb 17, 2020

I spent some time last week to create a block-based theme and felt it might be worth sharing it.

Things explored:

  • Typical block templates like 404.html, archive.html, home.html, page.html and single.html
  • More complex structure of block template parts using subfolders
  • Extra home page template with blocks using the front-page.html
  • Tried out the navigation block and added a basic mobile dropdown menu

Repo: https://github.com/Netzberufler/theme-experiments/tree/ambitious/ambitious

Copy link
Collaborator

@jffng jffng left a comment

Choose a reason for hiding this comment

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

Nice contribution, @Netzberufler!

I left a couple comments, but in general I appreciate how you're pushing the use of block templates and template parts to cover more aspects of the traditional theme template hierarchy.

What were the challenges or desires you encountered in the process of converting your design to an entirely block-based theme?


</div>
</div>
<!-- /wp:group -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is only going to be used within the home page template, is there a reason to create a separate template part for it? Why not just include it in the template itself?

The same question I think applies to:

  • content/content-page
  • content/content-404
  • content/content-single
  • front-page/content-front-page

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The content-home.html template is loaded from home.html and archive.html, so not used just once. But I should have named it content.html, got the name wrong.

I have to admit I did not re-think the template structure much, I basically replicated the former PHP template files. The content-page.html is used from index.html and page.html. I guess the other extra templates like content-404.html and content-single.html are not necessary, although it is nice to have the same structure for all block templates.


</div>
</div>
<!-- /wp:group -->
Copy link
Collaborator

Choose a reason for hiding this comment

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

I ran into this same use case of wanting to include content in block templates.

Since it's not re-used anywhere, I think this belongs in starter content rather than as a block template part.

Some related context in the Gutenberg repo: WordPress/gutenberg#18055

cc @kjellr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah okay, good to know. I saw the about.html and contact.html files in the Parisienne theme and thought theme authors can now directly provide block templates for starter content.

I think this actually would be a really great feature. So much easier to provide both starter content and a predefined block layout in just one template file, instead of having two separate places. I will check out the issue on the Gutenberg project about that, haven't seen that one yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I saw the about.html and contact.html files in the Parisienne theme and thought theme authors can now directly provide block templates for starter content.

Yeah, I think this would be a great improvement, either through "Starter Page Templates" as described above, or through something like what was explored in #16.

@Netzberufler
Copy link
Contributor Author

Nice contribution, @Netzberufler!

I left a couple comments, but in general I appreciate how you're pushing the use of block templates and template parts to cover more aspects of the traditional theme template hierarchy.

What were the challenges or desires you encountered in the process of converting your design to an entirely block-based theme?

@jffng Thanks so much for the quick response, I really appreciate it.

I think block templates already work great on the frontend and I had lots of fun building the theme. I can totally see myself using blocks all the way instead of PHP template tags and functions. It was also easier to switch to block templates than I thought beforehand. After playing around a bit with creating block layouts directly in the Editor I quickly jumped right into VS Code and wrote pure HTML.

Here are some issues I ran into:

The Navigation block was difficult to style, since it required to override the default CSS. I think it would be great if the Core styling would be implemented as a block style, so theme authors can start with an unstyled HTML list and provide their own additional block styles, e.g. for different menus in the header and footer.

Putting the block template parts into subfolders worked fine in the frontend, but the Editor on Gutenberg > Site Editor (beta) did not work at all with it.

It would be nice if theme authors had some Container Block which allows to add semantic markup like <header> and <footer>. I also felt that the Group block generates a lot of HTML markup, especially if you just want to wrap smaller elements like the post date.

I can see the need to be able to hide blocks from the user in the backend which should not be edited or deleted at any time. For example blocks to insert a Skip to Content link or a Hamburger menu icon.

One other feature I'd like to see is the possibility to lock certain blocks from editing. Right now it would break the theme layout if users add more columns to the header. I would like to have some more control here, so users can edit the site title and navigation block and add more blocks within the columns, but not break the responsive layout by adding or deleting columns.

Beside that, I'm just waiting until more blocks like the Query or Comments block are available.


I have planned to create issues for these points in the Guteberg repo the next days if I don't find preexisting ones. I haven't followed the development closely, so some things mentioned might be already covered :)

@jffng
Copy link
Collaborator

jffng commented Feb 18, 2020

@Netzberufler Great feedback, thank you for taking the time to share it!

It would be nice if theme authors had some Container Block which allows to add semantic markup like <header> and <footer>.

Definitely, this is starting to be explored here: WordPress/gutenberg#20218

And regarding the query block: WordPress/gutenberg#20106

I have planned to create issues for these points in the Guteberg repo the next days if I don't find preexisting ones. I haven't followed the development closely, so some things mentioned might be already covered :)

💪 This might be a useful project board to find / follow issues related to some of your concerns: https://github.com/WordPress/gutenberg/projects/35

@Netzberufler
Copy link
Contributor Author

Netzberufler commented Feb 20, 2020

Thank you for the links, these are very helpful :)

@jffng
Copy link
Collaborator

jffng commented Feb 20, 2020

@Netzberufler I'm going to merge this as I think it's a robust example for demonstrating how the existing theme template hierarchy can be ported to block templates.

I do think we should think more about how to address what's effectively starter content (#21 (comment)).

@jffng jffng merged commit 24fd5c7 into WordPress:master Feb 20, 2020
@dashkevych
Copy link

dashkevych commented Feb 20, 2020

I also felt that the Group block generates a lot of HTML markup, especially if you just want to wrap smaller elements like the post date.

I was not aware of this. I've checked your demo and I agree with you that it generates a lot of HTML. Is there any plans in a core to address this problem?

Theme HTML markup

@Netzberufler
Copy link
Contributor Author

Thanks so much for merging the theme.

I had some time today to create these two tickets:
WordPress/gutenberg#20375
WordPress/gutenberg#20376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants