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 a home page template using the latest posts block to 2019 #20

Merged
merged 3 commits into from
Feb 18, 2020

Conversation

youknowriad
Copy link
Contributor

This PR tries to add a home page showing the list of posts to the 2019 theme using the recent posts block.

@youknowriad youknowriad added the block-based theme A theme using HTML templates label Feb 17, 2020
@youknowriad youknowriad requested a review from kjellr February 17, 2020 09:51
@youknowriad youknowriad self-assigned this Feb 17, 2020
@@ -3,7 +3,9 @@
<!-- /wp:group -->

<!-- wp:group {"align":"full","className":"site-content"} -->
<div class="wp-block-group alignfull site-content"><div class="wp-block-group__inner-container"><!-- wp:post-title /--><!-- wp:post-content /--></div></div>
<div class="wp-block-group alignfull site-content"><div class="wp-block-group__inner-container">
<!-- wp:latest-posts {"postsToShow":100,"displayPostContent":true,"displayPostDate":true} /-->
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm showing 100 posts now because pagination is not supported yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm also showing the excerpt, post date and title. Ideally, this would use a "Query" block where you could decide to show post comment count... (but the query block is not implemented yet).

Copy link
Member

Choose a reason for hiding this comment

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

Definitely should be a Query since we need to read from the query context. It's also why I don't think adding pagination support to latest posts is a great idea: WordPress/gutenberg#19969 (comment)

@@ -112,6 +120,27 @@ Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-me
}
}

/* Latest posts block */
.wp-block-latest-posts li > a {
Copy link
Member

Choose a reason for hiding this comment

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

This is a great example of the things we should be absorbing in the block style work. cc @ItsJonQ @nosolosw.

Copy link
Member

Choose a reason for hiding this comment

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

One potential answer for this would be this proposal WordPress/gutenberg#20290

Copy link
Collaborator

@kjellr kjellr left a comment

Choose a reason for hiding this comment

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

This looks good! Fully agree that this should be done with the Query block when it's ready... the latest posts block actually has some very different built-in styles:

Screen Shot 2020-02-17 at 3 52 44 PM

(Honestly, those original styles look like a bug, so I'll look into that later 😅)

Luckily for the moment, those styles aren't being inherited here. 😄 This PR pointed out that the default block styles like those are only being used if the block lives directly inside of an "approved" container such as .entry-content, .site-header, or .site-footer. This is fine for now, but the original Twenty Nineteen style.css file could probably use a refactor in another PR so that those styles are less specific.

In any case, I added some minor fixes, and I think this is good to go as a proof of concept. We can revisit when the query block is live.

@youknowriad youknowriad merged commit 64a31e0 into master Feb 18, 2020
@youknowriad youknowriad deleted the add/homepage branch February 18, 2020 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block-based theme A theme using HTML templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants