Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Sites publish and unpublish

Wiktor Szczepaniak edited this page Sep 5, 2016 · 2 revisions

Sites management

Page activation operations - publish and unpublish

Using AEM Sites page, we can do several operations regarding page activation.

List of operations supported by Bobcat's SiteadminPage class :

  • publish page using method publishPage(String title)
  • unpublish page using method unpublishPage(String title)
  • publish page later using method publishPageLater(String title, LocalDateTime publicationDate)
  • unpublish page later using method unpublishPageLater(String title, LocalDateTime unpublicationDate)

Publish page

Assuming, that we have a existing page that can be published, we can use this example code :

@Test
Public void shouldPublishPage() {
	siteadminPage.publishPage(“example existing page”);
}

Unpublish page

Assuming, we have a existing page that can be unpublished, we can use example code below:

@Test
Public void shouldUnpublishPage() {
	siteadminPage.unpublishPage(“example existing page”);
}

Publish page later

To publish page later, we can use an example below:

@Test
public void shouldPublishPageLaterProperly() {
    LocalDateTime exampleFutureTime = LocalDateTime.now().plusMonths(2).plusDays(1).plusMinutes(2);
    siteadminPage.publishPageLater(“existing Page”, exampleFutureTime);
}

Unpublish page later

Similarly to above example, to unpublish page we can use code below :

@Test
public void shouldUnpublishPageLaterProperly() {
    LocalDateTime exampleFutureTime = LocalDateTime.now().plusMonths(2).plusDays(1).plusMinutes(2);
    siteadminPage.unpublishPageLater(“existing Page”, exampleFutureTime);
}

Back to Sites management

Getting started with Bobcat

  1. Getting started

AEM Related Features

  1. Authoring tutorial - Classic
  1. AEM Classic Authoring Advanced usage
  1. Authoring tutorial - Touch UI
Clone this wiki locally