Keď kompilujete šablónu, pre lokalitu v rámci tejto šablóny sa pre každú zo stránok v súbore structure.json vytvorí statická stránka HTML.
Krok kompilácie kombinuje metadáta stránky (napríklad 100.json) s rozložením stránky (napríklad about.html), takže získate stránku HTML, ktorá sa zobrazí okamžite, aj bez radiča v čase behu. Vlastné kompilátory kompilujú na stránku dynamické položky, napríklad navigáciu a komponenty, čím umožňujú ešte viac obmedziť spúšťanie skriptu JavaScript v čase behu.
Príkaz cec compile-template vykoná pre každú stránku na lokalite nasledujúce akcie:
page.json.src/templates/<template>/static.Spustite príkaz na kompiláciu lokality:
> 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.
Počas kompilácie dostanete tri typy hlásení: informačné, výstražné a chybové.
Poznámka:
Aby sa znížil počet opakovaných hlásení, rovnaké hlásenie sa počas jednej kompilácie zobrazí len raz bez ohľadu na to, či sa vyskytuje na viacerých stránkach.
Pre predchádzajúci príklad platí nasledujúci stav po skončení kompilácie:
Compilation completed with 0 errors and 3 warnings. to display warnings, run with --verbose (-v) option.
Ak krok kompilácie spustíte znova s voľbou „-v“, uvidíte nasledujúci výstup:
> 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
Pri kompilácii stránky detailov sa zoradia všetky obsahové položky nájdené počas kompilácie. Pre každú nájdenú obsahovú položku znova skompiluje stránku detailov s použitím hodnoty dynamického údajového poľa na definovanie adresy URL na novej stránke detailov.
Výstup predchádzajúcej kompilácie pozostáva z dvoch častí:
Na základe predchádzajúceho príkladu sa zobrazia upozornenia na položky mapy rozloženia obsahu pre stránku Starter-Blog-Author. Stránky detailov však nechceme pre Starter-Blog-Author. Stránka detailov je len pre obsahové položky Starter-Blog-Post. Aby sme tieto chyby odstránili, z kompilácie stránky detailov môžeme vylúčiť obsahové položky, ktoré v nastaveniach nemajú odkaz na explicitnú stránku detailov. Môžete na to použiť nasledujúcu voľbu:
--noDefaultDetailPageLink, -o Do not generate compiled detail page for items/content lists
that use the default detail page.
Keď teda znova spustíte kompiláciu a vylúčite vytvorenie stránky detailov, pri ktorom sa používa predvolená stránka detailov, dostanete nasledujúci výstup:
> 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
Je potrebné skompilovať všetky stránky v šablóne, pritom si ale môžete vybrať, ktoré stránky sa majú kompilovať. To je užitočné v prípade, ak chcete ladiť alebo aktualizovať len konkrétne stránky, na ktorých pracujete, a nie opakovane kompilovať celú lokalitu.
Na kompiláciu konkrétnych stránok použite voľbu --pages (-p) a za ňou uveďte zoznam stránok, ktoré chcete kompilovať.
Poznámka:
Poznámka: Ak sa obsahové položky nachádzajú v zozname referenčných stránok detailov, skompilujú sa aj stránky detailov, hoci neboli explicitne zahrnuté.
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