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

[Page list Block] Show untitled pages on page list on the editor #48772

Merged
merged 5 commits into from
Mar 13, 2023
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: 2 additions & 2 deletions packages/block-library/src/page-list-item/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function useFrontPageId() {
}

export default function PageListItemEdit( { context, attributes } ) {
const { id, label, link, hasChildren } = attributes;
const { id, label, link, hasChildren, title } = attributes;
const isNavigationChild = 'showSubmenuIcon' in context;
const frontPageId = useFrontPageId();

Expand Down Expand Up @@ -80,7 +80,7 @@ export default function PageListItemEdit( { context, attributes } ) {
} ) }
href={ link }
>
{ decodeEntities( label ) }
{ decodeEntities( title ) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

do we not need this too on line 70?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah we do, good catch.

</a>
) }
{ hasChildren && (
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/page-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ export default function PageListEdit( {
const hasChildren = pagesByParentId.has( page.id );
const pageProps = {
id: page.id,
label: page.title?.rendered,
label:
// translators: displayed when a page has an empty title.
page.title?.rendered?.trim() !== ''
? page.title?.rendered
: __( '(no title)' ),
title: page.title?.rendered,
link: page.url,
hasChildren,
Expand Down