Developer forum

Forum » Templates » Link to certain paragraph within a content placeholder

Link to certain paragraph within a content placeholder

Martin Kure
Reply

Hi, 

Is there a way to link not to a whole page, but only a specific paragraph within a placeholder? I would like to not only link to that part, but be able to set a template, that displays the content, whenever I click the link.

Example - employees:

I have a page with a placeholder, where the user can edit and create employee-info. They are all displayed on one page. Each employee are responsible for various tasks, which are described on other pages throughout the website. whenever a task is described I would like to add a link to the employee responsible for that task. It would be perfect, if I could use the employee-info page and then link to the paragraph with the individual employees. 

Thanks in advance.

Martin


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Martin

You can use named anchors to link to specific paragraphs

On page 1

<a id="task1" name="task1"></a>

On page 2

This is Martin - he is responsible for <a href="default.aspx?ID=otherpage#task1">Task 1</a>

BR Nicolai

 
Morten Bengtson
Reply
This post has been marked as an answer

If you want to be able to link to these paragraphs by inserting links in rich text or using the link field in items, you should stick to using the paragraph id on your elements. The link selector in DW creates paragraph links in a format like Default.aspx?ID=1#999, where 999 is the paragraph id.

Just make sure that your paragraphs are in a div (or any other element) with an id that is the same as the paragraph id.

Paragraph template...

<div id="<!--@ParagraphID-->">
<!--@ParagraphImage-->
<!--@ParagraphText-->
<!--@ParagraphModule-->
</div>

 

Votes for this answer: 1
 
Mikkel Ricky
Reply

The :target pseudo selector in CSS may come in handy as well: http://css-tricks.com/on-target/

Best regards,
Mikkel

 

You must be logged in to post in the forum