템플리트 컴파일

템플리트를 컴파일하면 템플리트 내의 사이트에 대한 structure.json 파일에 각 페이지의 정적 HTML 페이지가 생성됩니다.

컴파일 단계에서 페이지 메타데이터(예: 100.json)를 페이지 레이아웃(예: about.html)과 결합하므로 런타임에 컨트롤러 없이 즉시 HTML 페이지가 표시됩니다. 사용자정의 컴파일러를 통해 이전의 동적 항목(예: 탐색 및 구성요소)을 페이지로 컴파일하면 런타임 JavaScript 실행을 더 줄일 수 있습니다.

cec compile-template 명령은 사이트의 각 페이지에 대해 다음 동작을 수행합니다.

  • 사이트 및 페이지 메타데이터 읽기
  • 페이지 레이아웃을 읽고 페이지 레이아웃 컴파일러 적용
  • 페이지상 각 슬롯에 대해:
    • page.json 파일에 정의된 그리드로 슬롯 확장
    • 슬롯 내의 각 구성요소에 대해:
      • 구성요소 컴파일러 적용
      • 생성된 구성요소 마크업을 슬롯 내의 해당 위치에 삽입
  • 컴파일된 마크업에서 매크로를 확장하고 런타임에 Oracle Content Management 렌더러가 사용할 SCS JavaScript 객체 삽입
  • 컴파일된 페이지 마크업을 src/templates/<template>/static 폴더 아래에 저장

사이트를 컴파일하려면 다음을 실행합니다.

> cec compile-template BlogTemplate
Compile Template: compiling template BlogTemplate
Oracle Content Management Site Compiler

createPage: Processing pageId 100. Preview URL: 
http://localhost:8085/templates/BlogTemplate/index.html 
createPage: Processing pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail.html 
createPage: Processing pageId 401. Preview URL: 
http://localhost:8085/templates/BlogTemplate/about.html 
createPage: Processing pageId 402. Preview URL: 
http://localhost:8085/templates/BlogTemplate/search.html 
createPage: Processing pageId 403. Preview URL: 
http://localhost:8085/templates/BlogTemplate/authors.html 
All page creation calls complete.

Creating detail pages: 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063051-developing-content-layout- for-content-and-experience-cloud
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063052-dynamic-dom- manipulation-in-content-layout 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063045-getting-media-url-in- the-content-layout 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063053-getting-reference- items-in-content-layout 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063048-navigating-to-a- search-page-with-search-query 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063050-alex-read 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063047-jerrold-summers 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063049-kelly-emerson 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063043-samantha-howard 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063046-raising-triggers-from- content-layout 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063044-rendering-the-content- layout-using-mustache-template 
All detail page creation calls complete.

컴파일 오류

컴파일 동안 정보, 경고, 오류라는 세 가지 유형의 메시지를 받습니다.

  1. 정보 메시지는 사용자가 인지할 문제에 관한 것이지만 다음 메시지는 컴파일의 일부로 예상됩니다.
    • 런타임에 렌더링할 위치 표시자 콘텐츠 항목.
    • 누락된 페이지 레이아웃 컴파일러. 페이지 레이아웃에 동적 요소가 없을 수 있으므로 누락되어도 문제로 간주되지 않습니다.
    • "render on access"로 표시된 항목. 즉, 사이트 개발자는 페이지가 컴파일되더라도 이 구성요소가 런타임에 동적으로 렌더링되기를 원합니다.
  2. 경고 메시지는 실행 중인 사이트의 성능에 영향을 미치는 문제에 관한 것이며 가능한 수정해야 합니다. 이 범주의 항목은 다음과 같습니다.
    • 누락된 콘텐츠 레이아웃 또는 사용자정의 구성요소 컴파일러. 이것이 없으면 구성요소가 예전과 같이 동적으로 페이지에 렌더링됩니다.
    • 누락된 콘텐츠 레이아웃 맵. 콘텐츠 항목을 렌더링하기 위해 시스템 기본 콘텐츠 레이아웃을 사용하고 싶지는 않습니다.
  3. 오류 메시지는 컴파일 실패를 나타내는 문제에 관한 것입니다. 페이지는 가능한 계속 컴파일되지만 전체 컴파일은 오류와 함께 종료됩니다.
    • 대부분 사용자정의 컴파일러의 JavaScript 오류로 인해 발생하며 모든 오류를 해결해야 합니다.

주:

반복 메시지를 줄이기 위해 여러 페이지에 발생하든 관계없이 동일 메시지가 컴파일당 한번만 나타납니다.

앞의 예제에는 다음과 같은 컴파일 종료 상태가 있습니다.

Compilation completed with 0 errors and 3 warnings. 
to display warnings, run with --verbose (-v) option.

"-v" 옵션과 함께 컴파일 단계를 재실행하면 다음 출력이 표시됩니다.

> cec compile-template BlogTemplate --verbose
Compile Template: compiling template BlogTemplate 
Oracle Content Management Site Compiler

createPage: Processing pageId 100. Preview URL: 
http://localhost:8085/templates/BlogTemplate/index.html 
createPage: Processing pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail.html
Info: no content item specified for placeholder: a890a65c-c0fc-451b-966b-e606ca18a1f4 
component will render at runtime. 
Info: no content item specified for placeholder: c90bbc10-c9d8-4a54-8dd4-7a8251e8efbb 
component will render at runtime. 
Info: no content item specified for placeholder: f12691e1-79ab-4d1f-a8b9-3af8c638dd26 
component will render at runtime.
createPage: Processing pageId 401. Preview URL: 
http://localhost:8085/templates/BlogTemplate/about.html 
createPage: Processing pageId 402. Preview URL: 
http://localhost:8085/templates/BlogTemplate/search.html
Info: Component: "fdfd0392-e901-48f6-8044-36803c836aa1" of type "scs-contentlist" marked as 
"render on access", will not be compiled. 
Info: Component: "ba9f3711-4367-444e-ae38-71289fc10e73" of type "scs-contentlist" marked as 
"render on access", will not be compiled. 
createPage: Processing pageId 403. Preview URL: 
http://localhost:8085/templates/BlogTemplate/authors.html 
All page creation calls complete. 

Creating detail pages: 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063051-developing-content- layout-for-content-and-experience-cloud 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063052-dynamic-dom- manipulation-in-content-layout 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063045-getting-media-url-in- the-content-layout 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063053-getting-reference- items-in-content-layout 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063048-navigating-to-a- search-page-with-search-query 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063050-alex-read 
Warning: failed to find content layout map entry for: Starter-Blog-Author:header. Will compile 
using the system default layout.
Warning: failed to find content layout map entry for: Starter-Blog-Author:content. Will compile 
using the system default layout. 
Warning: failed to find content layout map entry for: Starter-Blog-Author:sidebar. Will compile 
using the system default layout.  
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063047-jerrold-summers 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063049-kelly-emerson 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063043-samantha-howard 
createPage: Processing detail pageId 105. 
Preview URL: http://localhost:8085/templates/BlogTemplate/post-detail/1481786063046-raising-triggers-from- content-layout 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063044-rendering-the-content- layout-using-mustache-template 
All detail page creation calls complete. 

Compilation completed with 0 errors and 3 warnings. 

*** compiled template is ready to test 
*** to render non-compiled pages, remove compiled files from under: /private/tmp/cec-
src/src/templates/BlogTemplate/static

세부정보 페이지 컴파일

세부정보 페이지 컴파일은 컴파일 중에 발생한 모든 콘텐츠 항목을 조합합니다. 그런 다음 새 세부정보 페이지의 URL을 정의하는 슬러그 값을 사용하여 발견한 각 콘텐츠 항목의 세부정보 페이지를 재컴파일합니다.

앞의 컴파일 출력은 다음 두 섹션에 나타납니다.

  1. 페이지 컴파일
  2. 세부정보 페이지 컴파일

앞의 예제에서 Starter-Blog-Author 페이지에 대한 콘텐츠 레이아웃 맵 항목이 없다는 경고가 표시됩니다. 그러나 Starter-Blog-Author에 대한 세부정보 페이지는 원하지 않습니다. 세부정보 페이지는 Starter-Blog-Post 콘텐츠 항목에만 필요합니다. 이 오류를 제거하기 위해 해당 설정에서 참조된 명시적 세부정보 페이지가 없는 경우, 다음 옵션으로 세부정보 페이지 컴파일에서 콘텐츠 항목을 제외할 수 있습니다.

--noDefaultDetailPageLink, -o  Do not generate compiled detail page for items/content lists
      that use the default detail page.

따라서 기본 세부정보 페이지를 사용하는 세부정보 페이지 생성을 제외하고 컴파일을 재실행하면 다음 출력이 생성됩니다.

> cec compile-template BlogTemplate --noDefaultDetailPageLink 
Compile Template: compiling template BlogTemplate 
Oracle Content Management Site Compiler 

createPage: Processing pageId 100. Preview URL: 
http://localhost:8085/templates/BlogTemplate/index.html 
createPage: Processing pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail.html 
createPage: Processing pageId 401. Preview URL: 
http://localhost:8085/templates/BlogTemplate/about.html 
createPage: Processing pageId 402. Preview URL: 
http://localhost:8085/templates/BlogTemplate/search.html 
createPage: Processing pageId 403. Preview URL: 
http://localhost:8085/templates/BlogTemplate/authors.html 
All page creation calls complete.

Creating detail pages: 
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063051-developing-content-
layout-for-content-and-experience-cloud
createPage: Processing detail pageId 105. Preview URL:
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063052-dynamic-dom -manipulation-in-content-layout
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063045-getting-media-url-in- the-content-layout
createPage: Processing detail pageId 105. Preview URL:  
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063053-getting-reference- items-in-content-layout
createPage: Processing detail pageId 105. Preview URL: 
http://localhost:8085/templates/BlogTemplate/post-detail/1481786063048-navigating-to-a- search-page-with-search-query
All detail page creation calls complete.

Compilation completed with no errors.

*** compiled template is ready to test 
*** to render non-compiled pages, remove compiled files from under: /private/tmp/cec-
src/src/templates/BlogTemplate/static

특정 페이지 컴파일

템플리트의 모든 페이지를 컴파일할 필요는 없으며 컴파일할 페이지를 선택할 수 있습니다. 이는 전체 사이트를 계속해서 재컴파일하지 않고 특정 페이지를 디버그하거나 업데이트하려는 경우 유용합니다.

특정 페이지를 컴파일하려면 --pages (-p) 옵션 뒤에 컴파일할 페이지 목록을 사용합니다.

주:

참고: 목록 참조 세부정보 페이지에 콘텐츠 항목이 있는 경우 명시적으로 포함하지 않더라도 세부정보 페이지도 컴파일됩니다.

cec compile-template BlogTemplate --pages 401,402 
Compile Template: compiling template BlogTemplate 
Oracle Content Management Site Compiler

createPage: Processing pageId 401. Preview URL: 
http://localhost:8085/templates/BlogTemplate/about.html 
createPage: Processing pageId 402. Preview URL: 
http://localhost:8085/templates/BlogTemplate/search.html 
All page creation calls complete.

Compilation completed with no errors. 
*** compiled template is ready to test 
*** to render non-compiled pages, remove compiled files from under: /private/tmp/cec- 
src/src/templates/BlogTemplate/static