Jens Jansson
Jens Jansson

Reputation: 4686

Deploy static html site into Liferay

I have a static site which just consists of html+js+css+images without any external dependencies. It's a lot of HTML pages in separate folders with links back and forth. It's a site compiled to static content with Jekyll.

I can drop it into any webserver or even Dropbox to view the site and everything works. Now I should integrate it to Liferay and I'm a little baffled on how to support a static site within in portal. I would have thought it to be a simple drop-into-place-and-use, but alas, there doesn't seem to be that option.

The only option I've found is something that I really don't like. I deploy the site somewhere else (dropbox for now) and have a generic portlet in Liferay. That portlet does this:

  1. Take the relative url of Liferay to see which page in the static site the user tries to access.
  2. Build an url to the dropbox-deployed site based on the base url + relative url
  3. Download the whole html for the actually deployed site
  4. Rewrite with regexp all the urls in the deployed site to point to the Liferay portal
  5. Grab the <body> of the static page and give it as a response in the portlet as it's own content.

This works somehow but it is ugly and causes a lot of issues with not being able to load <head>, loading additional resources like images, rewriting the urls correctly etc. etc.

I'm wondering if this is really the best course of action and I got no other options. Ideally I would just want to drop the set of files into the Liferay installation and be able to access them directly with an url like www.myliferay.com/mysite/somepage.html.

What I need from the portlet is to have it's own header and footer around my static content.

Upvotes: 1

Views: 1850

Answers (1)

glw
glw

Reputation: 1664

Copy your page directory directly to webapp directory on web server. Create portlet with index.jsp. Inside this jsp file add iframe tag with src="/your_page_directory/index.html" and add around header and footer content.

I think it is also possible to keep static content in portlet project and only difference is in src path, e.g. src="/portlet_context/your_page_directory/index.html"

Upvotes: 1

Related Questions