Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page Links error in FirstParagraph

Go to End

10 Posts   2938 Views


2 September 2010 at 2:38am Community Member, 13 Posts

If there is a link to another page on the site in the first paragraph of some Content, then:

$Content.FirstParagraph outputs "[[sitetree_link id=n]]" where the link was, while

$Content.FirstParagraph(html) outputs

<a href="[sitetree_link id=n]">text-for-page-being-linked-to</a>

I am using 2.4.1 and wonder if this is a bug.


2 September 2010 at 2:50am Community Member, 901 Posts

Looks like the text isn't getting parsed by the shortcode parser as it should. Having looked at the code, this seems to be the case and you should probably file a bug for it.


2 September 2010 at 3:15am Forum Moderator, 1796 Posts

I just notice (and posted) about this happening within UserDefinedForms too (although the site is on 2.4.0)


2 September 2010 at 3:20am Community Member, 13 Posts

Thanks banal, thought so. Bug submitted:



5 September 2010 at 8:49am (Last edited: 5 September 2010 11:10am), Community Member, 116 Posts

Just want to point out that this is happening with all html, not just the links.

Any wysiwyg styling in the first paragraph is basically turned into bbcode.

An external link to google outputs like:[]

When I bold something it literally outputs * some text i wanted bold, but just has asterisks around it *

Has the same issue.
But...this all works fine inside the blog module.

<% if BlogEntries %>
   <% control BlogEntries %>
      <% include BlogSummary %>
   <% end_control %>

works as expected.



26 September 2010 at 9:53pm Community Member, 93 Posts

Came across this issue similarly, in none the links were being parsed correctly for $Content.FirstSummary.

$Content.FirstSummary(html) along with the following tweak to /sapphire/core/model/fieldtypes/Text.php (Line 257):


return $data;


return ShortcodeParser::get_active()->parse($data);

Dirty short term fix via a change to core folder to boot, nevertheless it fixed the problem for me while I wait for the issue to be resolved more broadly.


21 January 2011 at 11:57pm Community Member, 37 Posts

This doesn't work for me, I think it needs a higher priority than "middle"!
It doesn't look nice - internal/external links and text highlighted bold for example.
Any other suggestions?


9 February 2011 at 10:31pm (Last edited: 9 February 2011 10:34pm), Community Member, 10 Posts

I solved this problem by post parsing my own rendered template.


class Page extends SiteTree {
   public function PageParseTemplate( $template ) {
    $data = $this->renderWith( $template );
    return ShortcodeParser::get_active()->parse($data);

<% control PreviewItems %>
<% end_control %>

The $ line above behaves just like <% include Preview %> with all the shortcodes resolved! :-)

Go to Top