0

I have followed this tutorial https://help.liferay.com/hc/en-us/articles/360018167031-Creating-Layout-Templates to create custom layout for Liferay 7.3. After deploy the layout to the Liferay manually using app manager, I'm not able to find the custom layout in Fragment and Widget option.

When I check in Global Menu > Control Menu > Components > Layout Templates. I'm able to see my custom layout.

Did I missed anything or is there any other way to add custom layout to Fragment and Widget options?

Thanks

A.Shah
  • 1
  • 2

2 Answers2

0

You missed one crucial info: "Layout Templates" are only applicable to pages of the type "Widget Page" (the default and pretty much only page layouting method in Liferay 6 and earlier). "Page Fragments", on the other hand, are only applicable to pages of type "Content Page" (which came up somewhere between 7.0 and 7.3). You set the type of a page at the moment you create them, by selecting one of the corresponding page templates.

So, if you want to create a certain row/column layout as a template for your "Content Page", you may want to look into the page fragment type "section". Basically, you'll be creating a Page Fragment that incorporates some <lfr-drop-zone id="invent-your-own-id"></lfr-drop-zone> tags in its HTML. Documentation on dropzones is very sparse at the moment (best source I found is Liferay's issue tracker plus experimenting yourself), but as this tag currently does not allow more attributes than id, you can simply experiment with it.

(Side notes: Due to some arcana in some standard documents, you cannot use the self-closing form of the <lfr-...> tags, so <lfr-drop-zone id="abc" /> will fail silently. Also, remember that the HTML part of a page fragment actually will be interpreted as an FTL template using Freemarkers alternative syntax before the <lfr-...> tags are interpreted., which gives you the option of placing a configurable amount of dropzones using a loop.)

But: take a moment to check whether you really need a custom "dropzone layout", as Liferay already provides you with a configurable "row section" in the content page editor; and anything more complex will give you headaches when making it responsive.

orithena
  • 1,455
  • 1
  • 10
  • 24
  • 1
    Hi orithena, thank you for your explanation. You are right, I missed the important parts "layout template". Now I can create my custom page fragment by following this documentation https://help.liferay.com/hc/en-us/articles/360029046471-Creating-Fragments. – A.Shah Nov 05 '20 at 06:18
0

We are going through this exact same situation. Up until 7.1, we used Layout Templates on Widget Pages to enforce a consistent design over our Org's Intranet, while still having per-Department Authors (see Herding Cats).

New requirements, including the Users overall desire to have more control over page layout and simplified editing, as well as personalization (using Segments), are forcing us to implement the features of Widget Pages (and Layout Templates) in Content Pages. So far, Page Fragment Sections (as @orithena suggested) are giving us a path forward.

Now, we're developing for 7.2. 7.3 seems to be taking this concept even further, with the afformentioned drop zones, nested row layouts, and Master Pages.

asteiner
  • 71
  • 4