Όταν μεταγλωττίζετε το πρότυπό σας, αυτό δημιουργεί μια στατική σελίδα HTML για καθεμία από τις σελίδες στο αρχείο structure.json
για την τοποθεσία εντός του προτύπου.
Το βήμα μεταγλώττισης συνδυάζει τα μεταδεδομένα σελίδας (για παράδειγμα, 100.json
) με τη διάταξη σελίδας (για παράδειγμα, about.html
) ώστε να έχετε μια σελίδα HTML που θα εμφανιστεί αμέσως χωρίς την ανάγκη για ελεγκτή κατά τον χρόνο εκτέλεσης. Τα προσαρμοσμένα εργαλεία μεταγλώττισης σάς επιτρέπουν να μειώσετε περαιτέρω τον χρόνο εκτέλεσης της JavaScript μεταγλωττίζοντας στη σελίδα τα προηγουμένως δυναμικά στοιχεία, όπως την πλοήγηση και τα συστατικά στοιχεία.
Η εντολή cec compile-template
θα προβεί στις ακόλουθες ενέργειες για κάθε σελίδα στην τοποθεσία:
page.json
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.
Κατά τη μεταγλώττιση, θα λάβετε τρεις τύπους μηνυμάτων: Πληροφορίες, Προειδοποίηση και Σφάλματα.
Σημείωση:
Για να περιοριστούν τα επαναλαμβανόμενα μηνύματα, το ίδιο μήνυμα θα εμφανίζεται μόνο μία φορά ανά μεταγλώττιση ανεξάρτητα από το εάν εμφανίζεται σε πολλαπλές σελίδες.
Το προηγούμενο παράδειγμα έχει την ακόλουθη κατάσταση εξόδου μεταγλώττισης:
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
Η μεταγλώττιση σελίδων λεπτομερειών κάνει συρραφή όλων των στοιχείων περιεχομένου που συναντά κατά τη μεταγλώττιση. Στη συνέχεια, μεταγλωττίζει ξανά τη σελίδα λεπτομερειών για κάθε στοιχείο περιεχομένου που βρίσκει, χρησιμοποιώντας την τιμή slug για να ορίσει τη διεύθυνση τοποθεσίας στη νέα σελίδα λεπτομερειών.
Η έξοδος της προηγούμενης μεταγλώττισης εφαρμόζεται σε δύο ενότητες:
Στο προηγούμενο παράδειγμα, βλέπετε προειδοποιήσεις για καταχωρίσεις χάρτη διάταξης χωρίς περιεχόμενο για τη σελίδα 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