Serve static HTML from Drupal 7

Ever wanted to serve a static HTML  page from Drupal? A quick-and-dirty was of doing this is as follows:

  1. Create a new subtheme from Zen or your favorite base theme, or roll your own. Maybe call it “Blank Theme.”
  2. Trim down your theme’s html.tpl.php file to look like this:
     <?php print $page; ?>
  3. Trim down your theme’s page.tpl.php file to look like this:
    <?php print render($page['content']); ?>
  4. Create a content type called “Static HTML” and paste the entire HTML doc in the body field of nodes of this content type. Ensure that the text filter for either defaults to “Full HTML” sitewide, or for this content type by using http://drupal.org/project/better_formats .
  5. Use http://drupal.org/project/themekey to create a rule that switches the theme to “Blank Theme” for this content/node type.
  6. [OPTIONAL]: Create a new content type called “File Attachment” and use https://drupal.org/project/attachment_links to manage any image or other assets in your static HTML through the Drupal UI. Use the links that this module provides to create a permalink to these files, thus avoiding Drupal’s default behavior or renaming new files uploaded to a given field. Otherwise, just reference your assets via <img src=”/hardcoded/path/to/theme/image01.png”/> and such.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: