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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion twentynineteen-blocks/block-templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)

</div></div>
<!-- /wp:group -->

<!-- wp:group {"align":"full","className":"site-footer"} -->
Expand Down
11 changes: 11 additions & 0 deletions twentynineteen-blocks/block-templates/singular.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- wp:group {"align":"full","className":"site-header"} -->
<div class="wp-block-group alignfull site-header"><div class="wp-block-group__inner-container"><!-- wp:template-part {"slug":"header","theme":"twentynineteen-blocks"} /--></div></div>
<!-- /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>
<!-- /wp:group -->

<!-- wp:group {"align":"full","className":"site-footer"} -->
<div class="wp-block-group alignfull site-footer"><div class="wp-block-group__inner-container"><!-- wp:template-part {"slug":"footer","theme":"twentynineteen-blocks"} /--></div></div>
<!-- /wp:group -->
54 changes: 47 additions & 7 deletions twentynineteen-blocks/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,59 @@ Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-me
}
}

/* Post title positioning */
/* Site content positioning */

.wp-site-blocks .site-content > .wp-block-group__inner-container > h1:first-child {
.wp-site-blocks .site-content > .wp-block-group__inner-container > *:not(.align-full):not(.align-wide) {
max-width: calc(100% - (2 * 1rem));
margin: 0 1rem;
}

@media only screen and (min-width: 768px) {
.wp-site-blocks .site-content > .wp-block-group__inner-container > h1:first-child {
max-width: 80%;
margin: 0 10%;
padding: 0 60px;
}
.wp-site-blocks .site-content > .wp-block-group__inner-container > *:not(.align-full):not(.align-wide) {
max-width: 80%;
margin: 0 10%;
padding: 0 60px;
}
}

/* Latest posts block */

.wp-block-latest-posts {
padding-left: 0;
}

.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

font-size: 2.25em;
font-weight: 700;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
color: #111;
line-height: 1.2;
}

.wp-block-latest-posts.wp-block-latest-posts__list li > a::before {
background: #767676;
content: "\020";
display: block;
height: 2px;
margin: 1rem 0;
width: 1em;
}

.wp-block-latest-posts.wp-block-latest-posts__list li:not(:first-child) {
margin-top: calc(6 * 1rem);
}

.wp-block-latest-posts .wp-block-latest-posts__post-date {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
font-size: 0.71111em;
margin-top: 0.71111em;
margin-bottom: 1.5em;
}

@media only screen and (min-width: 768px) {
.wp-block-latest-posts__post-excerpt {
max-width: calc(6 * (100vw / 12) - 28px);
}
}

/* Site navigation styles */
Expand Down