1
votes

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.

1
I'd say that Liferay is the wrong tool if you want to do nothing else than to publish static pages as you describe. Now if you want to add user-specific things, authentication and external applications & interactivity, we're talking. But if serving files is enough for your requirements: Serve files. Technically you can deploy the pages somewhere in Liferay, but this wouldn't gain anything with regards to the portal's features.Olaf Kock
Sorry, I didn't go into detail on my setup but I already had a longwinded post. We actually already have a big liferay site with thousands of users and integrated features. I want to add a section to it which I've built as static pages. It's a documentation site with hundreds of articles. I want to integrate it so that it shares the same look and feel, has header and footer, keeps you logged in while being on that part etc.Jens Jansson

1 Answers

1
votes

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"