Kompilera mallen

När du kompilerar mallen skapar den en statisk HTML-sida för var och en av sidorna i filen structure.json för webbplatsen i mallen.

I kompileringssteget kombineras sidmetadata (t.ex. 100.json) med sidlayouten (t.ex. about.html), så att du får en HTML-sida som visas omedelbart, utan behov av någon styrenhet vid exekvering. Med de anpassade kompilerarna kan du ytterligare reducera körningen av JavaScript vid exekvering, genom att låta tidigare dynamiska objekt, såsom navigering och komponenter, kompileras på sidan.

Kommandot cec compile-template utför följande åtgärder för varje sida på webbplatsen:

  • Läs i metadata för webbplats och sidor
  • Läs i sidlayouten och tillämpa eventuell sidlayoutkompilerare
  • För varje ruta på sidan:
    • Utöka rutan med det rutnät som definieras i filen page.json
    • För varje komponent i rutan:
      • Tillämpa valfri komponentkompilerare
      • Infoga den genererade komponentuppmärkningen på motsvarande plats i rutan
  • Expandera alla makron i den kompilerade uppmärkningen och infoga SCS JavaScript-objektet som används av renderaren för Oracle Content Management vid exekvering
  • Spara den kompilerade siduppmärkningen under mappen src/templates/<template>/static

Du kompilerar webbplatsen genom att köra:

> 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.

Kompileringsfel

Under kompilering får du tre typer av meddelanden: information, varning och fel.

  1. Infomeddelanden handlar om problem du bör vara medveten om, men de är förmodligen förväntade som en del av kompileringen:
    • Platshållarinnehållsobjekt som återges vid exekvering.
    • Sidlayoutkompilerare som saknas. Sidlayouter kanske inte innehåller några dynamiska element, och betraktas då inte som något problem om de saknas.
    • Objekt märkta som "render on access", dvs. webbplatsutvecklaren vill att den här komponenten ska återges dynamiskt vid exekvering, trots att sidan kompilerats.
  2. Varningsmeddelanden handlar om problem som sannolikt påverkar prestanda för webbplatsen som körs och som bör åtgärdas om möjligt. Objekt i den här kategorin följer:
    • Innehållslayoutkompilerare eller anpassade komponentkompilerare som saknas. Utan dessa återges komponenterna dynamiskt på sidan, som de gjorde tidigare.
    • Innehållslayoutmappningar som saknas. Det är osannolikt att du skulle vilja använda systemets standardinnehållslayout för att återge innehållsobjekt.
  3. Felmeddelanden handlar om problem som anger ett kompileringsfel. Sidorna fortsätter att kompileras om det är möjligt, men den övergripande kompileringen avslutas med ett fel.
    • Det här orsakas antagligen av JavaScript-fel i anpassade kompilerare, och alla fel måste korrigeras.

Obs!:

För att undvika upprepade meddelanden visas samma meddelande endast en gång per kompilering, oavsett om det förekommer på flera sidor.

Föregående exempel har följande status vid avslutad kompilering:

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

Om du kör kompileringssteget igen med alternativet "-v" ser du följande utdata:

> 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

Detaljsidkompilering

Vid detaljsidkompilering sorteras alla de innehållsobjekt som påträffas under kompileringen. Därefter omkompileras detaljsidan för varje innehållsobjekt som hittas, varvid värdet för beskrivande webbadress används för att definiera URL:en till den nya detaljsidan.

Föregående kompileringsutdata äger rum i två sektioner:

  1. Sidkompilering
  2. Detaljsidkompilering

I föregående exempel visas varningar om att poster för innehållslayoutmappning saknas för sidan Starter-Blog-Author. Vi vill emellertid inte ha detaljsidor för Starter-Blog-Author. Detaljsidan är endast för Starter-Blog-Post-innehållsobjekt. För att ta bort de här felen kan vi exkludera innehållsobjekt från detaljsidkompilering om de inte har någon explicit detaljsida som det refereras till i deras inställningar, med följande alternativ:

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

När kompileringen körs igen, och skapande av detaljsida exkluderas i de fall då standarddetaljsidan används, erhålls följande utdata:

> 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

Kompilera specifika sidor

Du behöver inte kompilera alla sidor i mallen, och du kan välja vilka sidor som ska kompileras. Det här är användbart om du arbetar på specifika sidor som du vill felsöka eller uppdatera, så att du slipper omkompilera hela webbplatsen gång på gång.

Om du vill kompilera specifika sidor ska du använda alternativet --pages (-p) följt av listan över de sidor som du är intresserad av att kompilera.

Obs!:

Obs! Om innehållsobjekt på sidorna i listan refererar till detaljsidor så kompileras även detaljsidorna, trots att de inte har inkluderats explicit.

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