Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Content & Markdown

Page Summary - Jump to delimiter upon click 'continue reading'

Started by NOT Andy Miller 9 years ago · 4 replies · 1253 views
9 years ago

Hello.

Using page summaries, when the user clicks "Continue reading" they are taken to the page but must scroll down to wherever they were to actually continue reading. Is there any way to automatically jump to the delimiter to eliminate this scrolling step?

My summary size is set to zero and I am manually inserting the delimiter to control the truncation - could this be a factor?

9 years ago

put a target tag in your content and then add this to the end of your readmore link?

YAML
---
title: My Page
---

you summary content

===

<a name="content-area">

your main content

Then in your Twig where you output your summary:

TWIG
<a href="{{ page.url }}#content-area>Read More...</a>
👍 1
9 years ago

Thanks Andy! Knew it would be something simple - I posted this Q on very little sleep and couldn't be bothered to try and figure it out myself at the time...

I moved the <a name="content-area"> up above the delimiter so my floating header isn't obstructing the content - otherwise works like a charm!

edit: if anyone else stumbles across this thread you'll need to close the link: <a name="content-area"></a>

last edited 11/12/17 by NOT Andy Miller
9 years ago

BTW you could write a plugin or add an event to your theme php that automatically adds the a Tag after the page summary delimiter just not sure if it’s wirth it or not 🙂

👍 1
9 years ago

Thanks for the suggestion. I've only got ~40 pages with continue_link: true so I manually updated them and will just integrate the addition of this snippet into my content template.

You can mark this thread as solved if you like

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 8 months ago
6 96 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 184 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 147 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 61 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 255 1 year ago