Oh How I Love Asset Publisher, And Making Peace With Content Friendly URLs

This is not really a technical post. In what follows, I share two little tips for Liferay 6.2 users. This may also be useful to developers, unless you prefer crafting SQL to solve all your data problems (which you probably do).

Let's get to them.

#1: Find journal articles that use a particular structure

Read the errata.

When I was starting out with Liferay CMS, one of the features I missed the most was the ability to say with ease what journal articles use a given structure. I explored various options on various screens in the Admin console. And when I couldn't find anything, as with all things in life, I sighed and crafted some joins.

A couple weeks ago, a front end developer posed the question to me. Now, it was even worded much the same way I had asked it of myself weeks before:

"How do you find content items that use a particular structure?"

I can only imagine that in the months in between visitations from this question, my brain had discovered the answer and stowed it away amongst some 3.7M neurons. But the synapses lit up just then (that's right, I paid attention during Biology class) and pushed the answer up past the boundaries of my lower subconscious. 

Three words: Asset Publisher Portlet

We use it all over the place to solve our business problems, but it just hadn't occurred to me earlier that I could use it for this meta-reason. 

When you go into the Configuration of an Asset Publisher portlet instance, you get to choose the Asset type (Web Content Article) and then the.... wait for it.... Web Content Article Subtype.

That's it. Remember: subtype = structure.

So my recommendation is this: when you are in the heat of development, create a page, which is hidden from navigation, with all permissions granted only to admin users. Drop an Asset Publisher on that page, and use it when you need it.

 

 

Errata

Thanks to Jader Francia who took a minute to and point out in his comment (and with admirable politeness) that there is a Browse by Structure option hidden in plain sight. I just missed it. I do like having an experimental asset publisher, but the central purpose for it is now duly obviated :-). 

This little gem came to me from the intelligentsia called the Liferay Incident Support Team. Bless their hearts. I am just sharing it here. 

 

At first glance, this section may seem superfluous because the steps to copy content are the same. However, one of the consequences of copying web content is that it automatically replicates and tweaks the content-friendly URL for the new copy.
Note: this is a known issue, and is being tracked here:  https://issues.liferay.com/browse/LPS-51210.
 
Follow the below steps to have a relevant content-friendly URL for your journal article.
 

Wait a second! What, kind Sir, could you possibly mean by "a relevant content friendly URL"? 

There's no need to be condescending indecision. The thing is, not following the below steps will result in journal articles having... how shall I say it... strange content-friendly URLs. For example, consider the awkwardness of seeing http://site.com/-/my-favorite-item-to-copy-1 in the address bar for a journal article that is titled "How To Become A Renegade Hacker".
 
To Create a Journal Article Titled How To Become A Renegade Hacker from an existing journal article titled My Favorite Item To Copy:
  1. Edit the journal article you are copying from. Change the Title from My Favorite Item To Copy to How To Become A Renegade Hacker
  2. Publish the article.
  3. While viewing the content list, click the recently-edited content item's dropdown arrow. Choose Copy, then Copy. 
  4. You should now have a copy created titled, How To Become A Renegade Hacker, with the correct content-friendly URL. 
  5. Test it by visiting http://site.com/how-to-become-a-renegade-hacker.
 
Blogs
Hi Javeed!
If I remember correctly, if you use the Web Content portlet into Site Administration, you have a feature to browse contents by structure.
So I think that issue #1 of your post can be solved in this way!

Is this correct?

Let me know, cheers, JF