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

Site editor sidebar: home template details #51223

Merged
merged 26 commits into from
Jun 20, 2023

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Jun 5, 2023

What?

Displays template and settings configuration details for the home and index templates.

See the designs and specs over at:

Status

  • Rest API changes for template/template part last modified in Templates API: return post modified datetime in response #51362
  • Clicking on a template area loads that template, but it breaks the back button. This is an existing issue, e.g., clicking on a template in the pages panel, then hitting back will take you to the templates panel (and not back to the pages panel)

Testing Instructions

With a block theme activated, head over to the site editor and open the home or index template.
Check that the settings controls work, and that the template area links open the correct template:

  1. The posts per page and allow block comments controls, when saved, should be synched with the settings on /wp-admin/options-reading.php
  2. When a static page is selected for the posts page on /wp-admin/options-reading.php, the post title control should display. Updating this field and saving should set the title of the posts page only.

Screenshots or screencast

State of this PR:

Home template as posts page Home template as Homepage
Screenshot 2023-06-16 at 11 13 14 am Screenshot 2023-06-16 at 11 13 29 am

@ramonjd ramonjd self-assigned this Jun 5, 2023
@github-actions
Copy link

github-actions bot commented Jun 5, 2023

Size Change: +1.54 kB (0%)

Total Size: 1.4 MB

Filename Size Change
build/edit-site/index.min.js 72.1 kB +1.2 kB (+2%)
build/edit-site/style-rtl.css 11.8 kB +153 B (+1%)
build/edit-site/style.css 11.8 kB +150 B (+1%)
build/editor/index.min.js 44.5 kB +41 B (0%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 955 B
build/annotations/index.min.js 2.69 kB
build/api-fetch/index.min.js 2.29 kB
build/autop/index.min.js 2.1 kB
build/blob/index.min.js 451 B
build/block-directory/index.min.js 6.99 kB
build/block-directory/style-rtl.css 1.02 kB
build/block-directory/style.css 1.02 kB
build/block-editor/content-rtl.css 4.22 kB
build/block-editor/content.css 4.22 kB
build/block-editor/default-editor-styles-rtl.css 381 B
build/block-editor/default-editor-styles.css 381 B
build/block-editor/index.min.js 196 kB
build/block-editor/style-rtl.css 14.9 kB
build/block-editor/style.css 14.9 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 90 B
build/block-library/blocks/archives/style.css 90 B
build/block-library/blocks/audio/editor-rtl.css 150 B
build/block-library/blocks/audio/editor.css 150 B
build/block-library/blocks/audio/style-rtl.css 122 B
build/block-library/blocks/audio/style.css 122 B
build/block-library/blocks/audio/theme-rtl.css 126 B
build/block-library/blocks/audio/theme.css 126 B
build/block-library/blocks/avatar/editor-rtl.css 116 B
build/block-library/blocks/avatar/editor.css 116 B
build/block-library/blocks/avatar/style-rtl.css 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/block/editor-rtl.css 305 B
build/block-library/blocks/block/editor.css 305 B
build/block-library/blocks/button/editor-rtl.css 584 B
build/block-library/blocks/button/editor.css 582 B
build/block-library/blocks/button/style-rtl.css 624 B
build/block-library/blocks/button/style.css 623 B
build/block-library/blocks/buttons/editor-rtl.css 337 B
build/block-library/blocks/buttons/editor.css 337 B
build/block-library/blocks/buttons/style-rtl.css 332 B
build/block-library/blocks/buttons/style.css 332 B
build/block-library/blocks/calendar/style-rtl.css 239 B
build/block-library/blocks/calendar/style.css 239 B
build/block-library/blocks/categories/editor-rtl.css 113 B
build/block-library/blocks/categories/editor.css 112 B
build/block-library/blocks/categories/style-rtl.css 124 B
build/block-library/blocks/categories/style.css 124 B
build/block-library/blocks/code/editor-rtl.css 53 B
build/block-library/blocks/code/editor.css 53 B
build/block-library/blocks/code/style-rtl.css 121 B
build/block-library/blocks/code/style.css 121 B
build/block-library/blocks/code/theme-rtl.css 124 B
build/block-library/blocks/code/theme.css 124 B
build/block-library/blocks/columns/editor-rtl.css 108 B
build/block-library/blocks/columns/editor.css 108 B
build/block-library/blocks/columns/style-rtl.css 409 B
build/block-library/blocks/columns/style.css 409 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 125 B
build/block-library/blocks/comment-author-avatar/editor.css 125 B
build/block-library/blocks/comment-content/style-rtl.css 92 B
build/block-library/blocks/comment-content/style.css 92 B
build/block-library/blocks/comment-template/style-rtl.css 199 B
build/block-library/blocks/comment-template/style.css 198 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 123 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 222 B
build/block-library/blocks/comments-pagination/editor.css 209 B
build/block-library/blocks/comments-pagination/style-rtl.css 235 B
build/block-library/blocks/comments-pagination/style.css 231 B
build/block-library/blocks/comments-title/editor-rtl.css 75 B
build/block-library/blocks/comments-title/editor.css 75 B
build/block-library/blocks/comments/editor-rtl.css 840 B
build/block-library/blocks/comments/editor.css 839 B
build/block-library/blocks/comments/style-rtl.css 637 B
build/block-library/blocks/comments/style.css 636 B
build/block-library/blocks/cover/editor-rtl.css 647 B
build/block-library/blocks/cover/editor.css 650 B
build/block-library/blocks/cover/style-rtl.css 1.61 kB
build/block-library/blocks/cover/style.css 1.6 kB
build/block-library/blocks/details/editor-rtl.css 65 B
build/block-library/blocks/details/editor.css 65 B
build/block-library/blocks/details/style-rtl.css 159 B
build/block-library/blocks/details/style.css 159 B
build/block-library/blocks/embed/editor-rtl.css 293 B
build/block-library/blocks/embed/editor.css 293 B
build/block-library/blocks/embed/style-rtl.css 410 B
build/block-library/blocks/embed/style.css 410 B
build/block-library/blocks/embed/theme-rtl.css 126 B
build/block-library/blocks/embed/theme.css 126 B
build/block-library/blocks/file/editor-rtl.css 316 B
build/block-library/blocks/file/editor.css 316 B
build/block-library/blocks/file/interactivity.min.js 395 B
build/block-library/blocks/file/style-rtl.css 269 B
build/block-library/blocks/file/style.css 270 B
build/block-library/blocks/freeform/editor-rtl.css 2.58 kB
build/block-library/blocks/freeform/editor.css 2.58 kB
build/block-library/blocks/gallery/editor-rtl.css 947 B
build/block-library/blocks/gallery/editor.css 952 B
build/block-library/blocks/gallery/style-rtl.css 1.53 kB
build/block-library/blocks/gallery/style.css 1.53 kB
build/block-library/blocks/gallery/theme-rtl.css 108 B
build/block-library/blocks/gallery/theme.css 108 B
build/block-library/blocks/group/editor-rtl.css 654 B
build/block-library/blocks/group/editor.css 654 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 76 B
build/block-library/blocks/heading/style.css 76 B
build/block-library/blocks/html/editor-rtl.css 336 B
build/block-library/blocks/html/editor.css 337 B
build/block-library/blocks/image/editor-rtl.css 834 B
build/block-library/blocks/image/editor.css 833 B
build/block-library/blocks/image/interactivity.min.js 1.34 kB
build/block-library/blocks/image/style-rtl.css 1.34 kB
build/block-library/blocks/image/style.css 1.34 kB
build/block-library/blocks/image/theme-rtl.css 126 B
build/block-library/blocks/image/theme.css 126 B
build/block-library/blocks/latest-comments/style-rtl.css 357 B
build/block-library/blocks/latest-comments/style.css 357 B
build/block-library/blocks/latest-posts/editor-rtl.css 213 B
build/block-library/blocks/latest-posts/editor.css 212 B
build/block-library/blocks/latest-posts/style-rtl.css 478 B
build/block-library/blocks/latest-posts/style.css 478 B
build/block-library/blocks/list/style-rtl.css 88 B
build/block-library/blocks/list/style.css 88 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 507 B
build/block-library/blocks/media-text/style.css 505 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 712 B
build/block-library/blocks/navigation-link/editor.css 711 B
build/block-library/blocks/navigation-link/style-rtl.css 115 B
build/block-library/blocks/navigation-link/style.css 115 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 296 B
build/block-library/blocks/navigation-submenu/editor.css 295 B
build/block-library/blocks/navigation/editor-rtl.css 2.35 kB
build/block-library/blocks/navigation/editor.css 2.36 kB
build/block-library/blocks/navigation/interactivity.min.js 978 B
build/block-library/blocks/navigation/style-rtl.css 2.21 kB
build/block-library/blocks/navigation/style.css 2.2 kB
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 401 B
build/block-library/blocks/page-list/editor.css 401 B
build/block-library/blocks/page-list/style-rtl.css 175 B
build/block-library/blocks/page-list/style.css 175 B
build/block-library/blocks/paragraph/editor-rtl.css 174 B
build/block-library/blocks/paragraph/editor.css 174 B
build/block-library/blocks/paragraph/style-rtl.css 279 B
build/block-library/blocks/paragraph/style.css 281 B
build/block-library/blocks/post-author/style-rtl.css 175 B
build/block-library/blocks/post-author/style.css 176 B
build/block-library/blocks/post-comments-form/editor-rtl.css 96 B
build/block-library/blocks/post-comments-form/editor.css 96 B
build/block-library/blocks/post-comments-form/style-rtl.css 508 B
build/block-library/blocks/post-comments-form/style.css 508 B
build/block-library/blocks/post-date/style-rtl.css 61 B
build/block-library/blocks/post-date/style.css 61 B
build/block-library/blocks/post-excerpt/editor-rtl.css 71 B
build/block-library/blocks/post-excerpt/editor.css 71 B
build/block-library/blocks/post-excerpt/style-rtl.css 141 B
build/block-library/blocks/post-excerpt/style.css 141 B
build/block-library/blocks/post-featured-image/editor-rtl.css 588 B
build/block-library/blocks/post-featured-image/editor.css 586 B
build/block-library/blocks/post-featured-image/style-rtl.css 319 B
build/block-library/blocks/post-featured-image/style.css 319 B
build/block-library/blocks/post-navigation-link/style-rtl.css 153 B
build/block-library/blocks/post-navigation-link/style.css 153 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 314 B
build/block-library/blocks/post-template/style.css 314 B
build/block-library/blocks/post-terms/style-rtl.css 96 B
build/block-library/blocks/post-terms/style.css 96 B
build/block-library/blocks/post-time-to-read/style-rtl.css 69 B
build/block-library/blocks/post-time-to-read/style.css 69 B
build/block-library/blocks/post-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 103 B
build/block-library/blocks/preformatted/style.css 103 B
build/block-library/blocks/pullquote/editor-rtl.css 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 335 B
build/block-library/blocks/pullquote/style.css 335 B
build/block-library/blocks/pullquote/theme-rtl.css 167 B
build/block-library/blocks/pullquote/theme.css 167 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 221 B
build/block-library/blocks/query-pagination/editor.css 211 B
build/block-library/blocks/query-pagination/style-rtl.css 288 B
build/block-library/blocks/query-pagination/style.css 284 B
build/block-library/blocks/query-title/style-rtl.css 63 B
build/block-library/blocks/query-title/style.css 63 B
build/block-library/blocks/query/editor-rtl.css 450 B
build/block-library/blocks/query/editor.css 449 B
build/block-library/blocks/quote/style-rtl.css 222 B
build/block-library/blocks/quote/style.css 222 B
build/block-library/blocks/quote/theme-rtl.css 223 B
build/block-library/blocks/quote/theme.css 226 B
build/block-library/blocks/read-more/style-rtl.css 132 B
build/block-library/blocks/read-more/style.css 132 B
build/block-library/blocks/rss/editor-rtl.css 149 B
build/block-library/blocks/rss/editor.css 149 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 178 B
build/block-library/blocks/search/editor.css 178 B
build/block-library/blocks/search/style-rtl.css 587 B
build/block-library/blocks/search/style.css 584 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 B
build/block-library/blocks/search/view.min.js 531 B
build/block-library/blocks/separator/editor-rtl.css 146 B
build/block-library/blocks/separator/editor.css 146 B
build/block-library/blocks/separator/style-rtl.css 234 B
build/block-library/blocks/separator/style.css 234 B
build/block-library/blocks/separator/theme-rtl.css 194 B
build/block-library/blocks/separator/theme.css 194 B
build/block-library/blocks/shortcode/editor-rtl.css 323 B
build/block-library/blocks/shortcode/editor.css 323 B
build/block-library/blocks/site-logo/editor-rtl.css 754 B
build/block-library/blocks/site-logo/editor.css 754 B
build/block-library/blocks/site-logo/style-rtl.css 203 B
build/block-library/blocks/site-logo/style.css 203 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 116 B
build/block-library/blocks/site-title/editor.css 116 B
build/block-library/blocks/site-title/style-rtl.css 57 B
build/block-library/blocks/site-title/style.css 57 B
build/block-library/blocks/social-link/editor-rtl.css 184 B
build/block-library/blocks/social-link/editor.css 184 B
build/block-library/blocks/social-links/editor-rtl.css 674 B
build/block-library/blocks/social-links/editor.css 673 B
build/block-library/blocks/social-links/style-rtl.css 1.43 kB
build/block-library/blocks/social-links/style.css 1.42 kB
build/block-library/blocks/spacer/editor-rtl.css 348 B
build/block-library/blocks/spacer/editor.css 348 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 433 B
build/block-library/blocks/table/editor.css 433 B
build/block-library/blocks/table/style-rtl.css 645 B
build/block-library/blocks/table/style.css 644 B
build/block-library/blocks/table/theme-rtl.css 146 B
build/block-library/blocks/table/theme.css 146 B
build/block-library/blocks/tag-cloud/style-rtl.css 251 B
build/block-library/blocks/tag-cloud/style.css 253 B
build/block-library/blocks/template-part/editor-rtl.css 403 B
build/block-library/blocks/template-part/editor.css 403 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/term-description/style-rtl.css 111 B
build/block-library/blocks/term-description/style.css 111 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 99 B
build/block-library/blocks/verse/style.css 99 B
build/block-library/blocks/video/editor-rtl.css 552 B
build/block-library/blocks/video/editor.css 555 B
build/block-library/blocks/video/style-rtl.css 174 B
build/block-library/blocks/video/style.css 174 B
build/block-library/blocks/video/theme-rtl.css 126 B
build/block-library/blocks/video/theme.css 126 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.1 kB
build/block-library/common.css 1.1 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/editor-rtl.css 12.2 kB
build/block-library/editor.css 12.1 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/index.min.js 201 kB
build/block-library/interactivity/runtime.min.js 2.69 kB
build/block-library/interactivity/vendors.min.js 8.2 kB
build/block-library/reset-rtl.css 478 B
build/block-library/reset.css 478 B
build/block-library/style-rtl.css 13.5 kB
build/block-library/style.css 13.5 kB
build/block-library/theme-rtl.css 686 B
build/block-library/theme.css 691 B
build/block-serialization-default-parser/index.min.js 1.12 kB
build/block-serialization-spec-parser/index.min.js 2.87 kB
build/blocks/index.min.js 50.8 kB
build/commands/index.min.js 14.9 kB
build/commands/style-rtl.css 827 B
build/commands/style.css 827 B
build/components/index.min.js 231 kB
build/components/style-rtl.css 11.8 kB
build/components/style.css 11.8 kB
build/compose/index.min.js 12 kB
build/core-commands/index.min.js 2.12 kB
build/core-data/index.min.js 15.7 kB
build/customize-widgets/index.min.js 11.9 kB
build/customize-widgets/style-rtl.css 1.46 kB
build/customize-widgets/style.css 1.45 kB
build/data-controls/index.min.js 640 B
build/data/index.min.js 8.25 kB
build/date/index.min.js 40.4 kB
build/deprecated/index.min.js 451 B
build/dom-ready/index.min.js 324 B
build/dom/index.min.js 4.63 kB
build/edit-post/classic-rtl.css 544 B
build/edit-post/classic.css 545 B
build/edit-post/index.min.js 34 kB
build/edit-post/style-rtl.css 7.58 kB
build/edit-post/style.css 7.57 kB
build/edit-widgets/index.min.js 16.8 kB
build/edit-widgets/style-rtl.css 4.53 kB
build/edit-widgets/style.css 4.53 kB
build/editor/style-rtl.css 3.54 kB
build/editor/style.css 3.53 kB
build/element/index.min.js 4.8 kB
build/escape-html/index.min.js 537 B
build/format-library/index.min.js 7.62 kB
build/format-library/style-rtl.css 554 B
build/format-library/style.css 553 B
build/hooks/index.min.js 1.55 kB
build/html-entities/index.min.js 448 B
build/i18n/index.min.js 3.58 kB
build/is-shallow-equal/index.min.js 527 B
build/keyboard-shortcuts/index.min.js 1.64 kB
build/keycodes/index.min.js 1.84 kB
build/list-reusable-blocks/index.min.js 2.13 kB
build/list-reusable-blocks/style-rtl.css 836 B
build/list-reusable-blocks/style.css 836 B
build/media-utils/index.min.js 2.9 kB
build/notices/index.min.js 948 B
build/plugins/index.min.js 1.77 kB
build/preferences-persistence/index.min.js 1.84 kB
build/preferences/index.min.js 1.24 kB
build/primitives/index.min.js 943 B
build/priority-queue/index.min.js 1.52 kB
build/private-apis/index.min.js 939 B
build/react-i18n/index.min.js 615 B
build/react-refresh-entry/index.min.js 8.44 kB
build/react-refresh-runtime/index.min.js 7.31 kB
build/redux-routine/index.min.js 2.7 kB
build/reusable-blocks/index.min.js 2.21 kB
build/reusable-blocks/style-rtl.css 243 B
build/reusable-blocks/style.css 243 B
build/rich-text/index.min.js 10.7 kB
build/router/index.min.js 1.77 kB
build/server-side-render/index.min.js 1.94 kB
build/shortcode/index.min.js 1.39 kB
build/style-engine/index.min.js 1.42 kB
build/token-list/index.min.js 582 B
build/url/index.min.js 3.57 kB
build/vendors/inert-polyfill.min.js 2.48 kB
build/vendors/react-dom.min.js 41.8 kB
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 958 B
build/warning/index.min.js 268 B
build/widgets/index.min.js 7.16 kB
build/widgets/style-rtl.css 1.15 kB
build/widgets/style.css 1.16 kB
build/wordcount/index.min.js 1.02 kB

compressed-size-action

@ramonjd ramonjd force-pushed the add/site-editor-sidebar-template-details branch from b11a8c7 to 5b42868 Compare June 6, 2023 05:48
@ramonjd ramonjd force-pushed the add/site-editor-sidebar-template-details branch from 5b42868 to 663c8b3 Compare June 7, 2023 05:59
@ramonjd ramonjd mentioned this pull request Jun 7, 2023
@jameskoster
Copy link
Contributor

jameskoster commented Jun 7, 2023

Discussion and comments controls/settings are not hooked up

There was some conversation in the issue about whether to include these on blog templates or not. The concern was that their inclusion would suggest the setting is blog specific, when in fact it applies to all post types. The same can be said for the Posts per page setting.

Edit: Probably fine to include, if we append some help text explaining the global nature of the settings:

Screenshot 2023-06-07 at 12 36 09

I know it's still a WIP, but I just wanted to note that in the Areas section, each entire row should act as a button, rather than only the name of the template part alone. Mockup:

Screenshot 2023-06-07 at 11 13 31

I suspect it might be worth cc'ing @ciampo and @mirka for any insight on how best to theme the input components.

@jameskoster jameskoster mentioned this pull request Jun 7, 2023
1 task
@ciampo
Copy link
Contributor

ciampo commented Jun 7, 2023

I suspect it might be worth cc'ing @ciampo and @mirka for any insight on how best to theme the input components.

Thank you for the ping!

While the Theme component is not ready to be used yet, we will have to rely on style overrides. The best thing would be to group all of the style overrides (text, background and border color) in one place/file, so that they can be easily found and removed once theming can be used. We could also add a comment wrapping those styles, stating that they are a temporary solution and that in general style overrides are discouraged.

@ramonjd
Copy link
Member Author

ramonjd commented Jun 8, 2023

Thanks for the updated designs @jameskoster !

The best thing would be to group all of the style overrides (text, background and border color) in one place/file, so that they can be easily found and removed once theming can be used. We could also add a comment wrapping those styles, stating that they are a temporary solution and that in general style overrides are discouraged.

Good idea, will do. 👍

@ramonjd ramonjd force-pushed the add/site-editor-sidebar-template-details branch 2 times, most recently from 5e61d7b to 381cc00 Compare June 9, 2023 04:13
@ramonjd
Copy link
Member Author

ramonjd commented Jun 9, 2023

I've removed "Last updated" changes because the current API does not support it.

We can reinstate once this PR is merged (if it does):

@ramonjd ramonjd added [Type] Enhancement A suggestion for improvement. [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jun 9, 2023
@ramonjd ramonjd force-pushed the add/site-editor-sidebar-template-details branch from f7d0092 to 798edab Compare June 13, 2023 00:20
@ramonjd ramonjd marked this pull request as ready for review June 13, 2023 00:24
@github-actions
Copy link

github-actions bot commented Jun 13, 2023

Flaky tests detected in 2ade33c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5317430391
📝 Reported issues:

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

This is testing really well! Just a couple questions below (mostly me trying to understand this better)

@@ -42,6 +43,11 @@ function useTemplateTitleAndDescription( postType, postId ) {
);
}

let content = null;
if ( record?.slug === 'home' || record?.slug === 'index' ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this applies to all blog templates, shouldn't it include the Archives template too? Or should it only apply to Home, with Index as a fallback if Home doesn't exist? Settings such as "site title" only really make sense on Home I guess 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question! I wasn't really sure about this. Happy to take instructions from @jameskoster here 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

No, because Archive and so on can display custom post types too. It may be that we add a local posts-per-page setting to to templates like Archive in the future, but let's start with the global stuff for now.

Settings such as "site title" only really make sense on Home I guess

The setting here should be Blog title, not Site title. And it should only be visible when a Posts Page is set. Updating the Blog title simply updates the title of the Posts Page.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updating the Blog title simply updates the title of the Posts Page.

@jameskoster Ah, that was a misinterpretation on my part, sorry!

I've updated this PR so that the "Blog title" input control only shows when a static page is selected as the posts page. The value of the input control updates the title of that page.

Screenshot 2023-06-14 at 2 09 49 pm

Copy link
Member Author

Choose a reason for hiding this comment

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

Just reflecting on the above change, I think I was unclear about why we would want to update the title of the posts page from the home template, when the two could have no relationship. For example, if I select page X as my posts page, it might use a page template and not the home or index templates.

Unless the intention is to surface general site settings?

The only other conclusion I could reach is we'd show these controls when we set a static page as the posts page and that static page uses the home/index template.

Anyway, let me know if I'm way off.

Copy link
Contributor

Choose a reason for hiding this comment

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

For example, if I select page X as my posts page, it might use a page template and not the home or index templates.

Please feel free to double-check but I think the Posts page will always resolve to either Home or Index. Note that the template switching UI in the post editor does not allow you to change the template when editing this page;

Screenshot 2023-06-14 at 11 05 59

I've updated this PR so that the "Blog title" input control only shows when a static page is selected as the posts page. The value of the input control updates the title of that page.

If the above is true, this sounds perfect!

Copy link
Member Author

@ramonjd ramonjd Jun 16, 2023

Choose a reason for hiding this comment

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

I think the Posts page will always resolve to either Home or Index.

Oh yes, good one! Another piece of the puzzle falls into place. 😄

I've updated this PR so that the "Blog title" input control only shows when a static page is selected as the posts page. The value of the input control updates the title of that page.

Just to confirm, and maybe you're aware of this already. Here's what I'm seeing:

  1. Select a page to act as the posts page (it uses the home page template in 2022 and 2023)
Screenshot 2023-06-14 at 2 09 49 pm
  1. Here's the page in question. The title is highlighted
Screenshot 2023-06-16 at 10 38 04 am
  1. When updating the post page title, the only thing that will change (only after save) on the home page is the nav menu item.
Screenshot 2023-06-16 at 10 48 52 am

@ramonjd ramonjd force-pushed the add/site-editor-sidebar-template-details branch from ff630c6 to 670d75f Compare June 14, 2023 04:54
@jameskoster
Copy link
Contributor

This is looking pretty good, thanks for all the hard work @ramonjd :)

So, I think I have uncovered a bit of an issue in updating the global posts per page setting in this panel. Many themes (including twenty twenty-three) set Query Loop blocks to inherit, but also override properties like perPage. Relevant code.

Consequently, updating the global posts per page setting here won't always update how many posts per page are displayed on this template, and that is going to make for a confusing experience 🙃

I'm very open to ideas here, but (if possible) one option could be to link the Posts per page control in the sidebar to the Query Loop in the template. There would be the following potential scenarios:

  • Query Loop has no perPage value: Control displays global value as a placeholder. Adding a value would add the property to the Query Loop.
  • Query Loop has a perPage value: Control displays that value. Changing it updates the Query Loop. Removing it would remove the property from Query Loop, and the control would display the global value.

Here's a mockup:

Screenshot 2023-06-14 at 12 27 27

What do you think?


A couple of smaller details:

  • One of the main benefits of having the settings and the frame visible together is that you can see the affect that changing settings will have in real time. With that said, could the frame update when you change the posts per page setting?
  • I suspect this will be best handled in a follow-up, but it's quite important: blocks like Post Title in the Home template should reflect the associated page data. Notice here how the Blog title input and the Post Title block are displaying different information:
Screenshot 2023-06-14 at 11 27 39

@ramonjd
Copy link
Member Author

ramonjd commented Jun 15, 2023

I think I get why I was stumbling over the requirements, thanks for helping me understand @jameskoster

I think my main problem was trying make the cognitive link between the specific home page template and overall site settings. For example, "Allow comments on new posts" doesn't have any direct relationship to the home page template being edited/viewed.

I'm wondering if these things will cause more confusion unless we better communicate their intended effect.

one option could be to link the Posts per page control in the sidebar to the Query Loop in the template

So, when I open a homepage template in view mode, we'd want to control (and update reactively) query block attributes in the editor from the sidebar. Or in other words, update block attributes in real time from the site editor sidebar in "view" mode.

It might be possible to drill down the template's block tree and find the first query block to display how many posts a home page query block displays. Even, use the clientId of a block and update its attributes via updateBlockAttributes (I haven't tried either of these yet). I would lean away from this idea: it's possible to have more than one query block (or any block) in a template, and it might be computationally heavy.

I'm just wondering why we couldn't guide folks to open the editor and do this in "edit" mode?

It's what the editor is set up for and what it does best.

I suspect this will be best handled in a follow-up, but it's quite important: blocks like Post Title in the Home template should reflect the associated page data. Notice here how the Blog title input and the Post Title block are displaying different information:

I think this would only make sense to do on the individual page, and only when that page is set to display posts. The post title block appears only on the page template that is set as the posts page in the reading settings.

So, taking 2023's home page template as an example, the "Mindblown: a blog about philosophy." heading is just a heading block.

Screenshot 2023-06-15 at 10 04 13 am

Updating it would require first finding, then updating that particular heading block's content. There could be 1 heading there could be 100 on a template and we wouldn't really know which heading acts as the "title".

Plus, and this is just my personal opinion, to me it blurs the lines of "view" and "edit" modes to allow updating of block-specific attributes from the sidebar.


This close to code freeze for 6.3, my vote would be to revisit this functionality. There's the risk of introducing something that half works or is buggy, if we can get things working at all.

With all this in mind, and at this stage, I think we could display some info that we know about the home template, e.g., like the page details panel. For example, we can already display template areas that appear on the template, e.g., footer and header (already done)

Furthermore, if a "home" template exists, and the reading settings are set to "homepage displays displays your latest posts", then we could display this.

I'll try to play with a few things so we have options.

@ramonjd
Copy link
Member Author

ramonjd commented Jun 15, 2023

Without the controls, here's something we could do now:

Screenshot 2023-06-15 at 4 11 13 pm

The last updated footer should appear on all template and template part panels once #51362 is merged.

The "This template is currently set as your homepage" label will only show if:

  • Your homepage displays your latest posts (in the reading settings)
  • There's no front-page template (which overrides any home page)

@ramonjd ramonjd force-pushed the add/site-editor-sidebar-template-details branch from ba8dbcf to f8344e7 Compare June 15, 2023 06:28
ramonjd and others added 20 commits June 20, 2023 10:37
Tweaking CSS accordingly
We can reinstate these changes once it's merged (also adding the property to core-data/src/entity-types/wp-template-part.ts)
Updating translations for entity types when saving
switching over site title editing to posts page title editing
- adds a last updated footer (if the modified property is available)
- removes all controls and addes details
Reinstate allow comments control
Abstract last modified footer
Use spin custom controls on the number control component
Update changelog
@ramonjd ramonjd force-pushed the add/site-editor-sidebar-template-details branch from ea8e9ad to a7d95ff Compare June 20, 2023 00:38
Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Nice work @ramonjd, this is looking good to me!

The features were all testing well according to the designs and how it's been developed 👍

The main issue I ran into is that the Blog title control feels a little edge-casey to me, in that when a posts page is set to the home page, the post title block doesn't appear to output anything within that template as far as I could tell. So, when using it, I didn't feel like I was updating the blog title, and I found it hard to draw the connection between this input and updating the title for the page itself. I see that the help text for the field explains that the title will appear in search results and when the page is shared on social media, but in terms of the UI, I found it difficult to understand how the feature is meant to be used. Since we're editing the Home template, as a user, my expectation is that Blog Title actually means Site Title. That could just be me, though!

The discussion surrounding that control could very well become a bit rabbit-holey, so I reckon it'd be a good idea to merge this PR in its current shape, and defer further exploration of the Blog Title control to follow-ups.

LGTM! ✨

} from '../sidebar-navigation-screen-details-panel';

export default function SidebarNavigationScreenDetailsFooter( {
lastModifiedDateTime,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiny nit: again not-blocking, but since this is a generic footer component, I was wondering if the check for whether or not to render the last modified row should exist within this component instead?

Just a thought though, and I wouldn't worry about changing it in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Excellent. I'll add it to the imminent follow-up

Comment on lines +115 to +119
useEffect( () => {
setCommentsOnNewPostsValue( allowCommentsOnNewPosts );
setPostsPageTitleValue( postsPageTitle );
setPostsCountValue( postsPerPage );
}, [ postsPageTitle, allowCommentsOnNewPosts, postsPerPage ] );
Copy link
Contributor

Choose a reason for hiding this comment

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

This syncs the server-retrieved values to local state, yeah? Only if you're making further changes anyway, would it be worth adding a comment just before this useEffect? It took me a second to work out what was happening.

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be worth it. Added to follow up notes. Thank you!

@ramonjd ramonjd enabled auto-merge (squash) June 20, 2023 01:10
@ramonjd ramonjd merged commit 7efbf84 into trunk Jun 20, 2023
50 checks passed
@ramonjd ramonjd deleted the add/site-editor-sidebar-template-details branch June 20, 2023 01:54
@github-actions github-actions bot added this to the Gutenberg 16.1 milestone Jun 20, 2023
sethrubenstein pushed a commit to pewresearch/gutenberg that referenced this pull request Jul 13, 2023
* Initial commit:
- refactoring page details so that the styles and components can be used in templates
- getting home template details in order

* - displaying template areas
- refactoring footer to show last modified in template and page details

* - bare bones rest controller changes to return modified for `get_item`
- linking up template areas

* - passing footer class to row

* - hooking into settings.

* Refactoring input controls layout
Tweaking CSS accordingly

* Reverted prefix change to file that was not copied to GB

* Removing last modified changes until the templates API supports it.
We can reinstate these changes once it's merged (also adding the property to core-data/src/entity-types/wp-template-part.ts)

* Showing the details pages for the index template
Updating translations for entity types when saving

* Fixed new unlock path

* updating design of area buttons
switching over site title editing to posts page title editing

* Updated hover states of area buttons

* This commit:
- adds a last updated footer (if the modified property is available)
- removes all controls and addes details

* Don't need these

* Reinstate post title and posts per page controls
Reinstate allow comments control
Abstract last modified footer

* Updated copy

* Update help text

* SidebarNavigationItem instead of button for links to template parts from the home template

* Wrap areas in ItemGroup

* Remove bottom margin on last detail panel

* Spacing

* Large inputs

* Leave border radius on inputs as 2px for now

* Use NumberControl

* Remove debounce
Use spin custom controls on the number control component
Update changelog

* Restore since annotation change made in WordPress#51362

---------

Co-authored-by: James Koster <james@jameskoster.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Enhancement A suggestion for improvement.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants