Expand my Community achievements bar.

Adobe Experience Manager: ページの公開日の日時表示フォーマットをカスタマイズする方法

Avatar

Employee
Note: This is a Japanese translation of an Adobe Experience League Knowledge Base article. Click this link for the original English version.
 
【目的】
AEM サイトコンソールでページの公開日を表示できますが、時刻までは表示されません。
公開日の日時フォーマットをカスタマイズして、時刻を含めて表示する方法をご説明します。
 
【環境】
AEM 6.5、AEM as a Cloud Service
 
【対応方法】
列表示と、リスト表示それぞれにオーバーレイを作成します。
 

列表示の場合

「/libs/cq/gui/components/coral/admin/page/columnpreview/columnpreview.jsp」をオーバーレイします。

 
  変更前

 

    // Published date and status
    if (!isDeactivated && publishedDate != null) {
%><foundation-time value="<%= xssAPI.encodeForHTMLAttr(publishedDate.toInstant().toString()) %>"></foundation-time><%
    } else {
        %><span><%= xssAPI.encodeForHTML(i18n.get("Not published")) %></span><%
    }

 

  変更後: foundation-timeタグに、type="datetime"属性を追加します。

 

    // Published date and status
    if (!isDeactivated && publishedDate != null) {
%><foundation-time type="datetime" value="<%= xssAPI.encodeForHTMLAttr(publishedDate.toInstant().toString()) %>"></foundation-time><%
    } else {
        %><span><%= xssAPI.encodeForHTML(i18n.get("Not published")) %></span><%
    }

 

リスト表示の場合
「/libs/cq/gui/components/coral/admin/page/row/row.jsp」をオーバーレイします。
 
  変更前

 

// published status
%><coral-columnview-preview-label><%= xssAPI.encodeForHTMLAttr(i18n.get("Published")) %></coral-columnview-preview-label><%
%><coral-columnview-preview-value><%
		if (!isDeactivated && publishedDate != null) {
				%><foundation-time value="<%= xssAPI.encodeForHTMLAttr(publishedDate.toInstant().toString()) %>"></foundation-time><%
		} else {
				%><%= xssAPI.encodeForHTML(i18n.get("Not published")) %><%
		}

 

  変更後: foundation-timeタグに、type="datetime"属性を追加します。

 

// published status
%><coral-columnview-preview-label><%= xssAPI.encodeForHTMLAttr(i18n.get("Published")) %></coral-columnview-preview-label><%
%><coral-columnview-preview-value><%
		if (!isDeactivated && publishedDate != null) {
				%><foundation-time type="datetime" value="<%= xssAPI.encodeForHTMLAttr(publishedDate.toInstant().toString()) %>"></foundation-time><%
		} else {
				%><%= xssAPI.encodeForHTML(i18n.get("Not published")) %><%
		}

 

 
<留意事項>
・上記は以下記事の抄訳/翻訳となります。
  KB記事タイトル(英語). Adobe Experience Manager: How to customize the display format of the page published date on the Sites console, July 18, 2023, 
・本記事にいただいたコメントへの返信はお約束できません。あらかじめご了承ください。

 

0 Replies