You easily import static HTML pages using dotCMS from other sources (such as when migrating a pre-existing site to dotCMS). There are two basic approaches to importing static HTML content into dotCMS:
Import Static Files Directly
dotCMS can directly serve static HTML pages and content, so you can directly upload static HTML pages and content into dotCMS and serve the pages directly from your dotCMS site.
- This is the fastest and simplest way to import existing static HTML content into dotCMS.
- However for long-term flexibility and maintainability (such as integration with dotCMS roles and permissions), you may wish to convert the static content to standard (dynamic) dotCMS content.
To upload static content directly into dotCMS:
- Upload the content into the dotCMS folder hierarchy
- Ensure all code and files reference the appropriate location in the dotCMS folder hierarchy
- If all of your existing references are relative, then all references should work after you upload the content to dotCMS as long as you ensure that the uploaded content maintains the same relative paths (subfolders, etc.) as it did in the original file.
- However if you have any absolute references in your uploaded content, or you choose to upload content into different locations in dotCMS, you will need to modify the paths to point at the appropriate file locations in dotCMS.
Convert Static HTML Pages to dotCMS Content
Static content the you upload directly into dotCMS will display properly, but may be more difficult to manage than standard dynamic dotCMS content.
When you upload static content directly into dotCMS, any non-HTML files you upload (such as images and CSS files) will be automatically converted to the standard dotCMS File Asset content type, allowing you to access these files from other dotCMS content as you would any other dotCMS file.
However when you upload HTML pages into dotCMS, those pages are uploaded as Simple HTML Pages into dotCMS, and can't take advantage of other dotCMS features (such as templates and containers, easy addition of content and widgets into an existing page, Content Types, etc.).
To enable your pages to use all available dotCMS features, you can convert the static HTML pages to regular dotCMS content, using the following basic process:
- Extract common/shared page elements (such as headers, footers, navigation, logos, etc.) into either a Theme or an Advanced Template.
- Extract the text portions of the page (including HTML formatting, where appropriate) into standard dotCMS content (such as the “Content (Generic)” Content Type).
- Extract any code in the page into one or more Widgets.
- Create a new Page Asset, using the appropriate Theme or Advanced Template (step 1, above).
- Add the content and code (steps 2 and 3) into the new page.
- Change the URL of the new page to replace the URL of the original (static) page.