Skip to content

Instantly share code, notes, and snippets.

@elindoorn
Last active October 13, 2023 14:26
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save elindoorn/fcd1c4a523b71a602ca5 to your computer and use it in GitHub Desktop.
Save elindoorn/fcd1c4a523b71a602ca5 to your computer and use it in GitHub Desktop.
Reserved web content variables
reserved-article-asset-tag-names
reserved-article-author-comments
reserved-article-author-email-address
reserved-article-author-id
reserved-article-author-job-title
reserved-article-author-location
reserved-article-author-name
reserved-article-author-organization
reserved-article-create-date
reserved-article-description
reserved-article-display-date
reserved-article-id
reserved-article-modified-date
reserved-article-small-image-url
reserved-article-title
reserved-article-url-title
reserved-article-version
Use in freemarker: ${.vars['reserved-article-create-date'].getData()}
Use in velocity: $reserved-article-create-date.getData()
List in 7.4: https://github.com/liferay/liferay-portal/blob/master/modules/apps/journal/journal-api/src/main/java/com/liferay/journal/constants/JournalStructureConstants.java
@Openskies
Copy link

Fantastic, thanks.

Is there a way to access Review-Date and Expiration-Date?

@elindoorn
Copy link
Author

Fantastic, thanks.

Is there a way to access Review-Date and Expiration-Date?

Unfortunately not through a reserved variable, so you'll have to use the JournalArticle object itself, unfortunately in a regular web content template that is not easily accessible (I believe that requires opening up the serviceLocator for the JournalArticleLocalService); depending on what your goal is, you may be able to get around it by using an ADT however

@Openskies
Copy link

Thanks, Elindoorn

All I want to achieve is to add the following information to a header of a Web Content Article type:

Review Date: xx-xx-xxxx
ReExpiration Date: xx-xx-xxxx
Status: Approve (or DRAFT)
Name of Approver: Joe Bloggs

That is it. All this information is displayed elsewhere (ie., history page), but the end users want the information at the top of the Document to save them having to go elsewhere to find it.

I don't need to add any new fields, I just want to call the information already captured and displayed elsewhere.

Any guidance would be much appreciated.

Best wishes
Nick

@elindoorn
Copy link
Author

Odd requirement, as this is info that is only useful for an editor of content, an end-user should have nothing to do with this (assuming an intranet like application). Also Liferay will not display content that is in draft or hasn't been reviewed yet, so I'm assuming you would have to make something custom for that. Which then would also allow you to make an ADT or something similar to display this stuff.

@Openskies
Copy link

I agree on the DRAFT note. I will make the same point, thank you.

However, being able to see the 'review date', 'expiration date', and the 'approver name' is very useful.

The use case is that the Web Document (content) will be printed out and the printed copy needs a header to show this metadata.

As a header, the reader can see, when the document must be reviewed, and, if it isn't reviewed, when it will expire.

Also ...

If I create a field, then anyone can put any dates or any persons name within it. What I need to show is who (using workflow) approved the document and when the Review and Expiration dates are — the paper copy reader won't have access to that information.

As I say — this is all information stored already, I just need to display and I assumed that there would be a variables to do so

@d80wrk
Copy link

d80wrk commented Apr 5, 2022

I had a feature request for stale content notification:
https://issues.liferay.com/browse/LPS-87724

"Aligned with roadmap" ... still not done. I don't hold much hope for getting reserved variables expanded since they've focused on modern site building, it feels like the existing features have almost been abandoned / ignored. It's almost like they don't know their own system.
Essentially a custom field could be added to work around and say in the Freemarker, compare the date in the custom field to today.

Assuming an intranet application <--- correct, Liferay may be blind to these use cases. Shout up for them.

Is there any use case for you using the knowledge base widget?

@d80wrk
Copy link

d80wrk commented Apr 5, 2022

"end-user should have nothing to do with this"
Not quite correct, look at the NHS website:

https://www.nhs.uk/conditions/hyperacusis/

"
Page last reviewed: 02 April 2019
Next review due: 02 April 2022
"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment