Detail page article title?

Feed 8 posts, 5 voices

Avatar
18 posts

Does anybody know how you can adjust the detailpage of an article? I want to add the title of the article above the content of it...

 
Avatar
1493 posts

I'm not sure I understand the issue, Jonas. The default layout for an article does have the title of the article above the content. Here's a screencap of the out-of-the-box Frog article behaviour (I hope the Markdown picture link works!):

Frog article image

Perhaps I've misunderstood your question though, in which case, do try again! Also, the code <?php echo $this->title(); ?> should give you the title of the current page.

Hope that helps!

 
Avatar
18 posts

Hi David,

thx for this quick reply. Here's what I did. I changed the name of the article page to news. Added some articles below it and when I click the title of one of the message to see the detail view it shows me the article but not the title of the article... Could this happen because I changed the pagename?

 
Avatar
18 posts

Me again,

I just found the problem... It wasn't in my layout template. Is there a way to just displays this when it is a detail view of an article? Some kind of php condition?

 
Avatar
343 posts

Hmm, I had some problems like that. Found a very simple solution. At least it works for my blog :D . Here is an example: <?php if ($this->comment_status != Comment::NONE) { ?> code to display if you are on a specific article <?php } ?>

 
Avatar
26 posts

I've recently been thinking it may be useful to have a $this->hasChildren() method which would allow one to check whether a page is a 'leaf' node in the tree. Since articles are almost always leaves, you could use:

<?php if (! $this->hasChildren()) : ?> code for specific articles <?php endif; ?>

 
Avatar
184 posts

I just came across this problem (not really used the articles feature until now) and in my case it was because I had set the parent ‘News’ page to an inheritted layout. Simply specifying a layout fixed the problem for me.