Skip to content

Commit 168a9c3

Browse files
authored
Merge pull request #3417 from kunj-sangani/dev
#3416 - Show Published Date in Page title
2 parents 49f9e07 + 8e162af commit 168a9c3

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

.vscode/tasks.json

+13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515
}
1616
}
1717
},
18+
"osx": {
19+
"options": {
20+
"shell": {
21+
"executable": "pwsh",
22+
"args": [
23+
"-NoProfile",
24+
"-ExecutionPolicy",
25+
"Bypass",
26+
"-File"
27+
]
28+
}
29+
}
30+
},
1831
"tasks": [
1932
{
2033
"label": "Build with nugets",

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
111111
- Added `ListsShowHeaderAndNavigation` parameter to always show lists with site elements intact when specified in `Set-PnPTenantSite` and `Set-PnPSite` cmdlets. [#3233](https://github.com/pnp/powershell/pull/3233)
112112
- Added `-AzureADWorkloadIdentity` parameter to `Connect-PnPOnline` cmdlet to support Azure AD Workload Identity authentication. [#3097](https://github.com/pnp/powershell/pull/3097)
113113
- Added Managed identity support for Power Platform related cmdlets. [#3097](https://github.com/pnp/powershell/pull/3097)
114+
- Added `-ShowInPublishDate` parameter to `Set-PnPPage` to allow the publication date to be shown or hidden on a page [#3417](https://github.com/pnp/powershell/pull/3417)
114115

115116
### Fixed
116117

documentation/Set-PnPPage.md

+24-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Sets parameters of a page
1818
Set-PnPPage [-Identity] <PagePipeBind> [-Name <String>] [-Title <String>]
1919
[-LayoutType <PageLayoutType>] [-PromoteAs <PagePromoteType>] [-CommentsEnabled]
2020
[-Publish] [-HeaderType <PageHeaderType>] [-HeaderLayoutType <PageHeaderLayoutType>] [-ScheduledPublishDate <DateTime>]
21-
[-RemoveScheduledPublish] [-ContentType <ContentTypePipeBind>] [-ThumbnailUrl <String>]
21+
[-RemoveScheduledPublish] [-ContentType <ContentTypePipeBind>] [-ThumbnailUrl <String>] [-ShowPublishDate <Boolean>]
2222
[-Translate][-TranslationLanguageCodes <Int[][]>]
2323
[-Connection <PnPConnection>]
2424
```
@@ -80,25 +80,31 @@ Schedules the page "MyPage" to be published in one hour from now
8080

8181
### EXAMPLE 8
8282
```powershell
83-
Set-PnPPage -Name "NewPage" -Translate
83+
Set-PnPPage -Identity "MyPage" -Translate
8484
```
8585

8686
Creates the necessary translated pages for all the supported languages in the site collection.
8787

8888
### EXAMPLE 9
8989
```powershell
90-
Set-PnPPage -Name "NewPage" -Translate -TranslationLanguageCodes 1043
90+
Set-PnPPage -Identity "MyPage" -Translate -TranslationLanguageCodes 1043
9191
```
9292

9393
Creates the necessary translated page for the specified language in the site collection. In this case, it will create the translated page for Dutch language. If the Dutch language is not enabled, it will enable the language and then create the translated page.
9494

9595
### EXAMPLE 10
9696
```powershell
97-
Set-PnPPage -Name "NewPage" -Translate -TranslationLanguageCodes 1043,1035
97+
Set-PnPPage -Identity "MyPage" -Translate -TranslationLanguageCodes 1043,1035
9898
```
9999

100100
Creates the necessary translated page for the specified languages in the site collection. In this case, it will create the translated pages for Dutch and Finnish languages. If these languages are not enabled, it will enable these languages and then create the translated pages for the specified languages.
101101

102+
### EXAMPLE 11
103+
```powershell
104+
Set-PnPPage -Identity "MyPage" -ShowPublishDate $true -Publish
105+
```
106+
Display the date when the page was published in the header section of the page
107+
102108
## PARAMETERS
103109

104110
### -CommentsEnabled
@@ -259,6 +265,20 @@ Accept pipeline input: False
259265
Accept wildcard characters: False
260266
```
261267
268+
### -ShowPublishDate
269+
Show Published Date in Header
270+
271+
```yaml
272+
Type: Boolean
273+
Parameter Sets: (All)
274+
275+
Required: False
276+
Position: Named
277+
Default value: None
278+
Accept pipeline input: False
279+
Accept wildcard characters: False
280+
```
281+
262282
### -Title
263283
Sets the title of the page.
264284

src/Commands/Pages/SetPage.cs

+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ public class SetPage : PnPWebCmdlet, IDynamicParameters
6060
[Parameter(Mandatory = false)]
6161
public int[] TranslationLanguageCodes;
6262

63+
[Parameter(Mandatory = false)]
64+
public bool ShowPublishDate;
65+
6366
private CustomHeaderDynamicParameters customHeaderParameters;
6467

6568
public object GetDynamicParameters()
@@ -129,6 +132,11 @@ protected override void ExecuteCmdlet()
129132
{
130133
clientSidePage.PageHeader.LayoutType = HeaderLayoutType;
131134
}
135+
136+
if(ParameterSpecified(nameof(ShowPublishDate)))
137+
{
138+
clientSidePage.PageHeader.ShowPublishDate = ShowPublishDate;
139+
}
132140

133141
if (PromoteAs == PagePromoteType.Template)
134142
{

0 commit comments

Comments
 (0)