Skip to content

Enhances 'spo page header set' with showTimeToRead#7098

Merged
MartinM85 merged 1 commit intopnp:mainfrom
milanholemans:enhances-headerset
Jan 8, 2026
Merged

Enhances 'spo page header set' with showTimeToRead#7098
MartinM85 merged 1 commit intopnp:mainfrom
milanholemans:enhances-headerset

Conversation

@milanholemans
Copy link
Copy Markdown
Contributor

Closes #7097

Remarks

Also updated the code to display a proper error message when the page is not found. The current error was not clear at all.

image

Copilot AI review requested due to automatic review settings January 6, 2026 15:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the spo page header set command by adding a new --showTimeToRead option that allows users to display the estimated reading time on SharePoint pages. Additionally, it improves error handling to provide clearer messages when a page is not found.

Key Changes

  • Added showTimeToRead boolean option to the command interface and implementation
  • Improved error handling for 404 responses to provide user-friendly error messages
  • Updated existing boolean options (showTopicHeader, showPublishDate) to accept explicit true/false values instead of being presence-only flags
  • Refactored code style (quote consistency, simplified validation using includes())

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/m365/spo/commands/page/page-header-set.ts Added showTimeToRead option, improved error handling for page not found, code style improvements (quotes, array includes), and proper TypeScript typing
src/m365/spo/commands/page/page-header-set.spec.ts Added test coverage for showTimeToRead option, updated all mock data to include the new property, added test for 404 error handling
src/m365/spo/commands/page/PageHeader.ts Added showTimeToRead property to PageHeaderProperties interface
docs/docs/cmd/spo/page/page-header-set.mdx Updated documentation to describe the new showTimeToRead option, improved descriptions for showTopicHeader and showPublishDate to clarify they accept boolean values, added Permissions section, updated example to demonstrate new option

Comment thread src/m365/spo/commands/page/page-header-set.spec.ts
@MartinM85 MartinM85 self-assigned this Jan 8, 2026
Copy link
Copy Markdown
Contributor

@MartinM85 MartinM85 left a comment

Choose a reason for hiding this comment

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

Great work. Only one small comment.

Comment thread src/m365/spo/commands/page/page-header-set.spec.ts
@MartinM85 MartinM85 marked this pull request as draft January 8, 2026 14:56
@MartinM85 MartinM85 marked this pull request as ready for review January 8, 2026 18:04
Copy link
Copy Markdown
Contributor

@MartinM85 MartinM85 left a comment

Choose a reason for hiding this comment

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

Approved

@MartinM85 MartinM85 merged commit de12bec into pnp:main Jan 8, 2026
16 checks passed
@milanholemans milanholemans deleted the enhances-headerset branch January 8, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance spo page header set with showTimeToRead option

3 participants