The Proposals Wiki has been deprecated in favor of creating Feature Requests in JIRA. If you wish to propose a new idea for a feature, visit the Community Ideas Dashboard and read the Feature Requests Wiki page for more information about submitting your proposal.
« Back to Asset Publisher

More flexible linking of web content to full page in Asset Publisher

Introduction #

A very common need of websites is to show a list of content abstracts (or even just titles) and link them to a different page (or sometimes a different portlet in the same page).

Within Liferay the two most common strategies to publish the list of content are:

  1. Asset Publisher: this is the simplest solution and it's quite powerful (especially since version 6)
  2. Web Content Display to publish a dummy web content that uses an XSL or Velocity template to query the content from a database: This solution requires more work and knowledge of XSL or Velocity but has the benefit of providing full control of the generated HTML and also the URL of the link to go to the full content view.

With the first solution, Asset Publisher, automatically implements support for linking to and showing the full content view, this view is always shown within the same portlet that published the list of abstracts/titles.

The second solution, using a velocity/XSL template and a Web Content display provides more flexibility and allows site administrators to link to a different page or a different portlet if desired. This is possible because the template author will have knowledge of the specific pages that have been created and the portlets within them so she can use this information to create the link.

The problem with this second solution is that it requires a bit of knowledge and many Liferay users don't even know that it exists. Because of this we would like to explore ways to improve Asset Publisher to be able to support linking to a full content view in a different page.

The goal of this page is to propose a solution for this problem.

Requirements #

  • It should be possible to link articles shown in an Asset Publisher instance to other instances of the portlet in the same page or in other pages.
  • It should be possible to specify different target pages for different web content based on their topic.
    • For example, a web content about soccer would be displayed in the page about sports, while a web content in the same list about physics would link to the page about science.
  • Each web content should have a single canonical URL, to achieve better SEO.
  • It should be relatively easy for a site administrator to edit all the web content that are linked to a given page and link them to a different one.
  • It must be possible for a given page to specify which Asset Publisher instance will be responsible for displaying a web content when linked from a different page.

An additional non-functional requirement is that the building of canonical URLs of web content should be very fast, since a single page may contain many of them.

Proposed solution #

Associating web content and pages #

The main idea behind this proposal is to have a closer association between web content and pages (layouts). This would be achieved by allowing the author of a page to select the default display page. This means that whenever that web content is shown in full view it will be shown within that page (unless specify otherwise through some other means).

In order to allow selection of the default display page there will be a new field in the web content form. This field will allow opening an overlay that will show the hierarchy of pages and will let the user select the one desired for target. Only those pages that have at least one Asset Publisher portlet (or one of its variations) will be selected as default display pages.

Whenever a web content is created from a given page (for example by using the "Add" menu in Asset publisher, as opposed to creating it from the control panel), that page will be automatically preselected as the default display page.

Canonical URLs per web content #

Each web content will have a unique associated URL of the form:

/group/friendly/url/_/friendly-url-of-the-web-content

For example a web content titled "Rafa Nadal wins yet another Grand Slam" in the public pages of the Sports community will have the following unique URL:

/web/sports/_/rafa-nadal-wins-yet-another-grand-slam

Or if Virtual Hosts are being used:

/_/rafa-nadal-wins-yet-another-grand-slam

The benefit of not including the page in the URL is that even if the associated page for the article changes, the URL of the web content will remain the same. This has benefits for SEO, bookmarkability and linkability.

Whenever the full view of the web content is shown in any other page of the portal, it will automatically add <meta> tags in the page to let search engines know about the canonical URL of the content.

Note that an underscore has been used so that the portal can identify that this is a canonical web content URL and give it the special behavior needed. Instead of an underscore a different URL prefix can be used. That prefix though, must be unusual enough to not be used as the name of any page and as the prefix for any portlet friendly URL.

Default web content publisher #

When a web content canonical URL is accessed, the portal will retrieve the web content from the database and determine what's the default display page for the content and will display it showing the web content in the asset publisher portlet that is configured to be the default web content publisher.

There will be an option to add to a page an asset publisher that is preconfigured to be the default web content publisher. Also the page administrator will be able to change which asset publisher portlet is the default web content publisher at any time through the configuration screen. If the instance currently selected is removed, the portal will automatically select other asset publisher instance as the target.

Building of links in lists of web content #

Whenever the Asset Publisher portlet is set up to show full web content in context (currently shown in the UI as the value "View in specific portlet" for the option "Asset Link Behavior"), the link to the full view of each web content will be its canonical URL.

If the web content does not have any default display page, it will be shown in the default web content publisher of the current page.

Note: since the "Asset Link Behavior" is very important for the usability of the feature being discussed, the following changes should also be made to it:

  1. Rename the field to "Show full content in..."
  2. The available options should be renamed as "This page" and "Specific page" (or "Associated page").

Batch changes of default display pages #

The web content administration portlet should be expanded to allow selecting several web content in order to associate a default display page to all of them.

Also, from each page, it should be possible for the page administrator to retrieve a list of all web content that point to that page and edit all of them in one step to set a different default display page. This operation will be executed automatically also whenever the page is deleted.

Improvement of navigation and sitemap portlets #

The navigation and sitemap portlets can also be improved by leveraging this feature.

Both portlets will be able to show each web content associated to a page as if it was a subpage. This behavior will be configurable since this might not be desired for sites with many web content.

Remaining challenges #

Sharing of content #

What would happen when an asset publisher shows content from the global scope? How do you define a default display page for web content in the global scope if there aren't any pages in that scope?

One of the features under consideration in the Liferay Roadmap is to expand the Content Sharing capabilities to allow a given site to publish content from other sites. How would this affect the solution described in this page?

One simple solution is that the canonical URL would be used which means that the full view of the content would be shown in the source site. This seems to be perfect, but what if the user doesn't have permission to access those pages? or what if the source site doesn't have any pages at all?

Staging and exporting/importing #

How does this affect staging as well as exporting/importing operations?

The main issue is how to store the association with the default display page. One solution could be to store the UUID of the page. Whenever the import process is done, if the target UUID page does not exist it may be a good idea to remove the reference. But this should be evaluated carefully just in case it's possible to apply other solution.

Default display pages without an asset publisher #

A site administrator could potentially remove all asset publisher instances from a page that has been selected as the default display page of one or more web content. What would happen in this case when the canonical URL of the web content is used?

In this case, the portal will dynamically add to the page an asset publisher portlet instance (only for the current request) and show it maximized (using the add-default-resource technique).

References #

0 Attachments
45908 Views
Average (8 Votes)
The average rating is 4.75 stars out of 5.
Comments
Threaded Replies Author Date
Awesome job Jorge and the contributors. Shagul Khajamohideen December 30, 2010 9:25 AM
Good proposal. What milestone or release is... Andrius Kurtinaitis January 2, 2011 11:45 PM
We are hoping to be able to implement this for... Jorge Ferrer January 27, 2011 9:01 AM
Those new features would be awesome! I hope it... Philipp Michael January 25, 2011 5:37 AM
This is exactly what we find is currently... Frederic Maheu February 1, 2011 9:03 AM
Excellent proposal! I'm looking forward to... Sven Werlen February 4, 2011 8:41 AM
"Web Content Display to publish a dummy web... Wojciech Tutro March 16, 2011 4:42 AM
I think the solution being proposed has been... Martin Kihuha March 29, 2011 9:17 AM
This feature will be helpful. Sheetal Mohan Sharma July 11, 2011 10:26 PM
Juan Fernández / Liferay Team, Please advise... Siva G November 4, 2011 2:15 PM
Team, Any one plz reply ... I need this feature... Siva G November 10, 2011 9:55 PM
We are in version 6.06, which are the steps to... Paolo Pilitti December 5, 2011 3:10 AM
doesnt work however, tried on 6.1. beta 4 Paolo Pilitti December 6, 2011 2:37 AM
i ve set a page with an asset publisher in it... Paolo Pilitti December 6, 2011 2:51 AM
would there be a way to build canonical urls... Marina Ra July 30, 2012 3:46 AM
hi thanke you for this article. I have 3 asset... shima shima September 15, 2014 10:17 PM

Awesome job Jorge and the contributors.
Posted on 12/30/10 9:25 AM.
Good proposal. What milestone or release is planned to implement it?
:-)
Posted on 1/2/11 11:45 PM.
Those new features would be awesome! I hope it will be implemented very soon.
Posted on 1/25/11 5:37 AM.
We are hoping to be able to implement this for 6.1. You can follow the progress here: http://issues.liferay.com/browse/LPS-15035
Posted on 1/27/11 9:01 AM in reply to Andrius Kurtinaitis.
This is exactly what we find is currently lacking as we are trying to use Liferay to manage thousands of articles. This would be big news for us as it would eliminate a lot of customization.

Any ETA on 6.1 ?
Posted on 2/1/11 9:03 AM.
Excellent proposal! I'm looking forward to testing it. Thank you Jorge!
Posted on 2/4/11 8:41 AM.
"Web Content Display to publish a dummy web content that uses an XSL or Velocity template to query the content from a database: This solution requires more work and knowledge of XSL or Velocity but has the benefit of providing full control of the generated HTML and also the URL of the link to go to the full content view."

Can any one provide some information how to do that? I was searching the web but without any example...
Posted on 3/16/11 4:42 AM.
I think the solution being proposed has been long overdue. Nonetheless, its more than welcome.

What I would request in the meantime is if community members could give the rest of us non-techies ideas on how we can achieve the way to link to a full content view in a different page.

Currently, am forced to do this process manually and it is quite tedious!
Posted on 3/29/11 9:17 AM.
This feature will be helpful.
Posted on 7/11/11 10:26 PM.
Juan Fernández / Liferay Team,
Please advise when and what version of LR we need to download to achieve this functionality as the issue says resolved. I am a beginner in using LR. Please provide the direct URL where i can download the new version. Currently i am having LR6.0.6 .your help is highly appreciable.
Posted on 11/4/11 2:15 PM in reply to Sheetal Sharma.
Team,
Any one plz reply ... I need this feature to implement urgently ... plz help me in explaining how to use this feature.
Posted on 11/10/11 9:55 PM in reply to Siva G.
We are in version 6.06, which are the steps to implement this fix?
Posted on 12/5/11 3:10 AM in reply to Siva G.
doesnt work however, tried on 6.1. beta 4
Posted on 12/6/11 2:37 AM.
i ve set a page with an asset publisher in it configured as Set as the Default Asset Publisher for this Page , i ve create a web content with diplay page the page above, but when i click on the detail of the article it stays on the original page. The asset Publisher seems not save the configuration about Set as the Default Asset Publisher for this Page .Lifegray continue not work
Posted on 12/6/11 2:51 AM in reply to Paolo Pilitti.
would there be a way to build canonical urls for knowledge base articles as well? meaining: each article receives it´s own canonical url
Posted on 7/30/12 3:46 AM.
hi thanke you for this article.
I have 3 asset in a page and I want to show full content of each on in a full page as www.newsfirst.com
now I disable "Set as the Default Asset Publisher for This Page" . what should I do more to have link to full-story as this website?
Regard
Posted on 9/15/14 10:17 PM.