Liferay: How to get rederer page meta description in content page - liferay

problem is getting meta description for twitter:description.
Currently portal-normal.ftl is handling rendering page metadata and opengraph-markup-section.ftl
is handling content page metadata. If both(render page/source page, and content page) have meta description, they are both displayed.
I can remove pageMetaDescription insertion in portal-normal.ftl file but then if content page does not contain pageMetaDescription, there is no description at all.
How can I achieve logic: if web content pageMetaDescription is empty -> then get renderer/source_page pageMetaDescription. Thank you.

Related

Google search result has wrong description

my page has set description in meta like this
<meta name="description" content="My best website"/>
Until now this description was displayed with my page in google search result. Now there is totally different text from footer in my page.
Can I change it somehow to be like before?
resubmit your page (via sitemap etc) to google webmaster. Also check that content of your description tag appears on your page, Google may perhaps think that your description tag is irrelivent to your actual page content text and therefore will ignore it and just take stuff from the page itself.

How to link to an individual web content item in Liferay?

Let's say that I am using an AUI Carousel to display a news item slideshow.
This is a typical slideshow - a series of images with overlay text and each image/overlay text links to a web content article for the site's news.
It seems that with Liferay 6.2, it's only possible to link to a page containing the article rather than the article itself.
How does one link to an individual article?
The solution here is to use a Display Page; starting with Liferay 6.1, there is the concept of Canonical URLs (see here).
In order to use this, you need two things:
an asset publisher page (in my example here, the page is called News)
when creating the web content item, set the Display Page to the above (News)
Now the content item can be referred to via: http(s)://<site-url>/-/<web-content-item-url-title>
So, if I have a web content item with the name Come Join Us For Lunch, and a site url of http://my-site.com/, the canonical URL for this web content item will be http://my-site.com/-/come-join-us-for-lunch
However, you should always get the actual url-title from
JournalArticle.getUrlTitle()

Getting the URL for a file's metadata page in Liferay

I've been tasked with creating a new column in the list of files in a Liferay 6.2 document library. For each file, that column should display a link with the text "Details" and the URL for that file's metadata page. In view_entries.jsp, I'm looking to add this field to a ResultRow. All I've been able to find so far, is DLUtil's getPreviewURL, which only seems to give me the URL for downloading the file itself, rather than leading to the metadata page. The Title column uses a TextSearchEntry, which ends up displaying with the URL I want, but I can't figure out how to either get that URL from it or change the text it displays the link with.
PortletURL rowURL = liferayPortletResponse.createRenderURL();
rowURL.setParameter("struts_action", "/document_library/view_file_entry");
rowURL.setParameter("redirect", HttpUtil.removeParameter(currentURL, liferayPortletResponse.getNamespace() + "ajax"));
rowURL.setParameter("fileEntryId", String.valueOf(fileEntry.getFileEntryId()));
In this code, fileEntry is the current document. To get the URL to the preview page, it's just rowURL.toString().

How does browser detect embedded web content from a HTML page?

Once a browser gets the main html page, how does it know which are the embedded content should be request again from web server, and which are only external links? Is it based on type of tags, e.g ?
If so, could someone give me a reference of what these tags are?
Thanks.
The HTML5 spec defines the element category "Embedded content":
Embedded content is content that imports another resource into the document, or content from another vocabulary that is inserted into the document.
It lists the following elements:
audio
canvas
embed
iframe
img
math
object
svg
video
Elements like link or script (both in Metadata category) can also refer to other ressources that user-agents (browsers, screen-readers, …) are free to link to or include or do whatever they want to do with it. For example, browsers like Firefox or Chromium will (by default) load and "apply" CSS that is linked within the link element, that has the rel value = stylesheet. Browsers like Lynx or w3m won't do that. They simply ignore that link.
For link, HTML5 states which link types "are links to resources that are to be used to augment the current document, generally automatically processed by the user agent":
Two categories of links can be created using the link element: Links to external resources and hyperlinks. The link types section defines whether a particular link type is an external resource or a hyperlink.
Maybe also consider the style attribute (for inline CSS), which could include a background-image url.
Yes, the tags help browser identify the resources to load. After downloading/retrieving the content the browser determines what to do with the content based on the content-type header in the response.

Orchard CMS adding an additional HTML part to page content type?

I'm trying to break my body into pre content, content, and post content so I can inject ads and what not within my articles. The only HTML field module is broken for 1.4 at the moment and I can't seem to add additional body parts to the page. I'm having to create my pre content in the body, then cut the HTML into a pre conntent text field. And do the same thing for post content. There's got to be a better way to do this. Is there any way to have more than one HTML editor field in the page editor?
As I told you in another answer, you can configure the Text field to use HTML. Just add the text field, and then expand it in the type editor. There is a drop-down where you can choose HTML.

Resources