Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to know if a content is page or blog ?

liljoint April 25, 2012

Hi, I need to know if a content is page or blog. does exists any parameter to know it?

Please help, thnx.

2 answers

1 vote
SarahA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2012

Hallo Bryan

One way to differentiate between a page and a blog post: Check the URL. A blog post contains the date in the URL, like this:

http://MY.CONFLUENCE.COM/display/SPACEKEY/2012/04/20/PAGE+NAME

But a page has just the page name:

http://MY.CONFLUENCE.COM/display/SPACEKEY/PAGE+NAME

I hope this answers the question. :)

Cheers, Sarah

0 votes
Matthew J. Horn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 6, 2012

There are programmatic ways to tell whether content is a blog or a page as well. I think what you want is the ContentEntityObject's getTypeEnum() method. I haven't tested this yet, but it would look like this:

$content.getTypeEnum()

That should return one of the ContentTypeEnum's constants which includes BLOG, COMMENT, PAGE, etc...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events