Foros de discusión

Theme for CMS with Automated Page Generation

thumbnail
Fuad Efendi, modificado hace 16 años.

Theme for CMS with Automated Page Generation

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
Hi,
I want to develop theme which can check 'links' and generate 'pages' with 'portlet' (if they don't exist yet) accordingly to settings in displayed Journal Article.
Which API do I need? Which Velocity variables?

I have few hundreds of 'expandable' Journal Articles, and I'll need to implement 'expandability via JavaScript/DOM (not acceptable due to SEO and UA), or (this is better) to have the ability of several templates attached to journal article.

When user clicks on Journal Article link, new page should be generated, with friendly URL etc., showing more details. Making this as a portlet is not possible... again, SEO. I need URL to a page.

Any advice guys!

Thanks
thumbnail
Fuad Efendi, modificado hace 16 años.

RE: Theme for CMS with Automated Page Generation

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
I think I should go different way, using Velocity and code snippet from liferay-noir-theme:

#if ($journalArticleLocalService.hasArticle($group_id, $journalArticleId))
$velocityPortletPreferences.setValue("portlet-setup-show-borders", "false")
$velocityPortletPreferences.setValue("group-id", "$group_id")
$velocityPortletPreferences.setValue("article-id", $journalArticleId)

$theme.runtime("56_INSTANCE_a453", "", $velocityPortletPreferences.toString())

$velocityPortletPreferences.reset()
#end



I can pass journalArticleId as a request parameter, and using UrlRewriteFilter I can have friendly URLs too.


Next question: how to assign different Journal Template at runtime?
thumbnail
Fuad Efendi, modificado hace 16 años.

RE: Theme for CMS with Automated Page Generation

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
It does not work, and I reopened LEP-3458.

Even if it works... temporary workaround in RuntimeTag.java:
if (Validator.isNotNull(defaultPreferences)) {
PortletPreferences prefs = PortletPreferencesFactoryUtil.getPortletSetup(
req, portletId, true, true, defaultPreferences);

prefs.setValue("article-id", defaultPreferences);

prefs.store();


}


- pass $articleId instead of $velocityPortletPreferences.toString().


Even if it works, it is not 'thread-safe', it changes PortletPreferences for current Request:
?articleId=99999


When we call $theme.runtime("JOURNAL_CONTENT_$journalArticleId", "", $velocityPortletPreferences.toString())

with non-existing PortletPreferences "JOURNAL_CONTENT_$journalArticleId" - it will be created! But it won't be added to Layout.

It seems that I can't use such technics for the task...

Another possible solution:
com.liferay.portal.servlet.FriendlyURLServlet

- here I can put a code which will create non-existing Layout with PortletPreferences etc...


P.S.
I have a business requirements: when new article is added, Asset Publisher should 'publish' a link to a new article page.
Mariano Cifre, modificado hace 15 años.

RE: Theme for CMS with Automated Page Generation

Junior Member Mensajes: 86 Fecha de incorporación: 27/05/08 Mensajes recientes
Hi Fuad,

We are planning on a migration to Liferay and would like to have this feature also.

We are trying to have a list of headline news in the home screen and once you click on a piece of news it should show the complete news/story and obviously with the metadata information stored (description and keywords).

Did you find a way to do it? I think that your idea of creating another theme for the Journal content is a good workarround...

My fast solution was deploying the Message Board, but unfortunately it does not fill the metadata information...

Any help will be greatly appreciated!

Thanks,
Mariano.
thumbnail
Ray Augé, modificado hace 15 años.

Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS with Au

Liferay Legend Mensajes: 1197 Fecha de incorporación: 8/02/05 Mensajes recientes
> We are trying to have a list of headline news in the home screen and
> once you click on a piece of news it should show the complete
> news/story and obviously with the metadata information stored
> (description and keywords).
>


We already support this in two different ways...

a) using Asset Publisher (less customizable, more point and click)
b) using dynamin Journal Templates which list/generate links to Journal
Content portlet specifying the Friendly URL (more customizable, less
point and click, see the Wiki)

HTH!
Mariano Cifre, modificado hace 15 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Junior Member Mensajes: 86 Fecha de incorporación: 27/05/08 Mensajes recientes
Ray Augé:

We already support this in two different ways...


Glad to here that!

I have so many things to check in order to migrate that I missed that...

I'll look for it and keep you posted!

Thanks for the fast response! It is really appreciated!

Mariano.
Mariano Cifre, modificado hace 15 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Junior Member Mensajes: 86 Fecha de incorporación: 27/05/08 Mensajes recientes
Hi Ray,

I'm afraid that none of them allows metadata information such as keywords and page description, right?
The asset also does not change the page title.

Do you know any way to change the page description and keywords according to the published content?

I've already searched on the forum, but didn't find anything related...

Thanks in advance!
Mariano.
Mariano Cifre, modificado hace 15 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Junior Member Mensajes: 86 Fecha de incorporación: 27/05/08 Mensajes recientes
Hi again!

Well... Below is what I tried with no luck. Please, let me know if you found a solution...

First of all, I tried with the easy way... The Asset publisher. It does not allow to change the title and it was not what expected when I wanted to see the abstract list...

Then, I tried with the Journal Template.

I followed the wiki tutorial, but as the portlet is shown in the middle of the page, the browser doesn't show the title defined in the template, as it is not located on the <head/>.

As using the Journal Template was not a solution, I tried changing the jedi-template located on /webapps/liferay-jedi-theme/templates.

If I change the title with a static text there was no problem... but if I change the title with a variable from the content structure, it just show the text as if the variable does not exist, which I think is true, because the content did not appear at the time it renders the <head/>...

This is my code:

	<title>$company_name - $the_title - $title.getData() - $title</title>


company_name is shown.
the_title is also shown, but it is the page title, not the content shown title.
title is an attribute from the structure of the content shown. I also tried with other variable names.

Really, I have no clue how to resolve this... I think it is possible somehow...

Please, if you have any idea let me know.

Thank you!
Mariano.
thumbnail
Ray Augé, modificado hace 15 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Liferay Legend Mensajes: 1197 Fecha de incorporación: 8/02/05 Mensajes recientes
Hello Mariano,

Sorry for the late response, but after reading your replies I understand
more your requirement, and I'm sad to inform you that we don't currently
have the ability to manipulate the elements in the "head" of the HTML
doc from a portlet. emoticon

BUT, there is an optional portion of the JSR-286 Portlet
Specification 2.0 Proposal
which DOES define such a mechanism, which
would enable us to make the Journal have the ability to do what you
describe, and I'm on a research mission to see if we can get this in
sometime soon.

I'll quote the portion of the proposal here for reference:
JSR-286 - Portlet Specification 2.0 (Proposed):
PLT.12.5.4
Setting Markup Head Elements


A portlet can set markup head elements at the response via the
[tt]addProperty[/tt] method with

[tt]MimeResponse.MARKUP_HEAD_ELEMENT (value:
"javax.portlet.markup.head.element")
as property name and an [tt]org.w3c.dom.Element[/tt] value.

This property is intended to be a hint to the portal application that
the provided DOM
element should be added to the markup head section of the response to
the client.

Support for this property is optional and the portlet can verify if the
calling portal
supports this property via the [tt]MARKUP_HEAD_ELEMENT_SUPPORT[/tt]
property on the
[tt]PortalContext[/tt].

Even if the calling portal supports this property, delivery of the DOM
element to the
client cannot be guaranteed, e.g. due to possible security rules of the
portal application or
elements that conflict with the response of other portlets.

For render calls, portlets should set head properties in the render
headers part of the
render lifecycle phase or simply override the
[tt]GenericPortlet.doHeaders[/tt] method (see
PLT.11.1.4.3) in order to run with maximum performance on all portal
implementations.
Mariano Cifre, modificado hace 15 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Junior Member Mensajes: 86 Fecha de incorporación: 27/05/08 Mensajes recientes
You rock, Ray!

Your response was fast enough! =)

So, what is your suggestion if I'm moving to Liferay before this is implemented?

I mean, do I create the "headline news" as a Journal Articles and display them with a custom Theme? or should I do it in any other way, so that the future transition has less work?

Thanks! I am looking forward to the new feature! =)
Mariano Cifre, modificado hace 15 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Junior Member Mensajes: 86 Fecha de incorporación: 27/05/08 Mensajes recientes
Hi Ray,

I saw your comment some time ago and today I was thinking about your comment...

Ray Augé:
(...) I'm sad to inform you that we don't currently have the ability to manipulate the elements in the "head" of the HTML doc from a portlet. emoticon


The forum does allow to change (at least) the page title according to the content shown (no keywords or meta-description, yet). How could this been implemented? Do you know?

Thanks!
Mariano.

PS: Perhaps this would need another thread, but usually nobody replies when creating a new one...
thumbnail
Milan Jaroš, modificado hace 15 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Expert Mensajes: 268 Fecha de incorporación: 18/08/08 Mensajes recientes
I think this is really important. Fuad Efendi posted partial solution in forum but it isn't exactly what Journal Content needs I think.
I'll try to find some solution in near future.
Tony Lim, modificado hace 14 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Junior Member Mensajes: 90 Fecha de incorporación: 15/04/09 Mensajes recientes
Here's how you get the metadata

themeDisplay.getLayout().getTypeSettingsProperties().getProperty("meta-description_" + themeDisplay.getLocale())
thumbnail
David García González, modificado hace 13 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Regular Member Mensajes: 127 Fecha de incorporación: 14/07/09 Mensajes recientes
Tony Lim:
Here's how you get the metadata

themeDisplay.getLayout().getTypeSettingsProperties().getProperty("meta-description_" + themeDisplay.getLocale())


I tried this code, but it did not work for me. I changed it to the following code:


#set ($description = $typeSettingsProperties.getProperty("meta-description_$themeDisplay.getLocale()"))
<meta name="description" content="$description">
thumbnail
David García González, modificado hace 13 años.

RE: Re: [Liferay Forums][4. Custom Theme Development] RE: Theme for CMS wit

Regular Member Mensajes: 127 Fecha de incorporación: 14/07/09 Mensajes recientes
You could also obtain the meta data importing the jsp top_meta.jspf