Beim Kompilieren der Vorlage wird eine statische HTML-Seite für jede Seite in der Datei structure.json
für die Site in der Vorlage erstellt.
Der Kompilierungsschritt kombiniert die Seitenmetadaten (z.B. 100.json
) mit dem Seitenlayout (z.B. about.html
). So erhalten Sie eine HTML-Seite, die zur Laufzeit sofort angezeigt wird, ohne dass ein Controller erforderlich ist. Mit den benutzerdefinierten Compilern können Sie die JavaScript-Laufzeitausführung weiter beschleunigen, indem zuvor dynamische Elemente, wie Navigation und Komponenten, in der Seite kompiliert werden.
Der Befehl cec compile-template
führt die folgenden Aktionen für jede Seite in der Site aus:
page.json
definiert istsrc/templates/<template>/static
speichernUm die Site zu kompilieren, führen Sie Folgendes aus:
> 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.
Während der Kompilierung können drei Meldungstypen angezeigt werden: Informationen, Warnung und Fehler.
Hinweis:
Um wiederholte Meldungen zu reduzieren, wird dieselbe Meldung nur einmal pro Kompilierung angezeigt, unabhängig davon, ob sie auf mehreren Seiten auftritt.
Das oben genannte Beispiel weist den folgenden Beendigungsstatus bei der Kompilierung auf:
Compilation completed with 0 errors and 3 warnings. to display warnings, run with --verbose (-v) option.
Wenn Sie den Kompilierungsschritt mit der Option "-v" erneut ausführen, wird die folgende Ausgabe angezeigt:
> 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
Bei der Detailseitenkompilierung werden alle bei der Kompilierung gefundenen Inhaltselemente sortiert. Dann wird die Detailseite für jedes gefundene Inhaltselement mit dem Slug-Wert neu kompiliert, um die URL zur neuen Detailseite zu definieren.
Die oben angegebene Kompilierungsausgabe erfolgt in zwei Abschnitten:
Im oben genannten Beispiel werden Warnungen zu fehlenden Inhaltslayoutmap-Einträgen für die Seite Starter-Blog-Author angezeigt. Es sind allerdings keine Detailseiten für Starter-Blog-Author gewünscht. Die Detailseite dient nur für Starter-Blog-Post-Inhaltselemente. Um diese Fehler zu entfernen, können Sie Inhaltselemente aus der Detailseitenkompilierung ausschließen, wenn für diese Elemente keine explizite Detailseite in den Einstellungen referenziert wird. Verwenden Sie dazu die folgende Option:
--noDefaultDetailPageLink, -o Do not generate compiled detail page for items/content lists that use the default detail page.
Wenn Sie die Kompilierung dann erneut ausführen und dabei die Detailseitenerstellung mit der Standarddetailseite ausschließen, erhalten Sie die folgende Ausgabe:
> 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
Sie müssen nicht alle Seiten in der Vorlage kompilieren, sondern können die gewünschten Seiten auswählen. Das bietet sich an, wenn Sie spezielle Seiten debuggen oder aktualisieren möchten, ohne die ganze Site ständig erneut kompilieren zu müssen.
Um spezifische Seiten zu kompilieren, verwenden Sie die Option --pages (-p)
gefolgt von der Liste der gewünschten Seiten.
Hinweis:
Hinweis: Wenn Inhaltselemente auf den Seiten in der Liste Detailseiten referenzieren, werden die Detailseiten ebenfalls kompiliert, auch wenn sie nicht explizit aufgenommen werden.
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