Long piece of content breaking page

#1

Hello,

I have a problem that is leaving me scratching my head.

One of my pages which is the longest pieces of content I have is breaking my “blog list” page.

If I post all of the content I get an error in the editor “invalid security token” and it breaks my blog list page making it look like this:

If I only post the first paragraph it works fine and the blog list page looks like this:

Does Grav have some kind of limit on the length content can be?

I upped my php memory limit to 128M and post_max_size to 15M.

I’ve verified the markdown and everything checks out.

Any help would be greatly appreciated as I’ve been at this for the majority of the day.

#2

@Morticai

TL;DR: Cannot reproduce with a 400 page long plain text without markdown. Would you mind sharing more info on the content of the page?

Test:

  • Created a new blog page using Lorem Ipsum generator: Generated 1500 paragraphs, 132950 words, 898900 bytes. That takes roughly 400 page scrolls on a 1366 x 768 screen…
  • Site: Skeleton blog site.

Results:

  1. Browsing to blog home page:

    Server Error
    Sorry, something went terribly wrong!

    0 - Maximum function nesting level of ‘256’ reached, aborting!
    For further details please review your logs/ folder, or enable displaying of errors in your system configuration.

    Log page grav.log:

    grav.CRITICAL: Maximum function nesting level of ‘256’ reached, aborting!
    … Grav/Common/Helpers/Truncator.php(173)

    It fails to create a proper truncation to display as summary.

  2. Added === to create reasonable summary size.

  3. Browsing to blog home page: All is well.

  4. Browsing to large blog item itself: All is well.

  5. Admin page editor: Editing/saving works.

#3

@pamtbaau You’ve saved me twice in 2 days, very much appreciated! I’d like to buy you a beer or something if there is a way to do that!

I turned on the logs but nothing was showing up.

I added === as a delimiter and now the summary is rendering properly.

What is odd is if I turned summary off, it would just show the entire post in the summary section, but at least it would load.

P.S. is there a way to write a custom summary, that won’t show up on the actual content page?

#4

@Morticai Glad to hear your issue has been solved. You might mark it accordingly to enrich the forum…

When turning summary off it won’t try to find a decent summary and shows the entire page.

enabled: false – Switch off page summary (the summary returns the same as the page content)

See Summary for settings.

Custom summary:
Only options I know are page.summary() and page.content(). You might try to add a custom summary option into frontmatter and adjust blog-list-item.html.twig (Quark), like:

{% if page.header.custom_summary %}
    {{ page.header.custom_summary }}
{% elseif page.summary != page.content %}
    {{ page.summary }}
{% else %}
    {{ page.content }}
{% endif %}

And maybe add a custom_summary field to the /blueprints/item.yaml?

1 Like
#5

@pamtbaau you are the best!

So I got the custom summary working if I manually put it in the frontmatter.

I added this to my item.yaml

customsummary:
type: text
label: customsummary
placeholder: ===

It shows the option in my admin panel, but won’t save.

#6

@Morticai

Add this in item.yaml right above import@:

header.summary.custom:
  type: textarea
  toggleable: true
  label: Custom Summary
  classes: large
  rows: 5
  placeholder: Add your custom summary here

And change blog-list-item.html.twig to:

{% if page.header.summary.custom %}
    {{ page.header.summary.custom }}
{% elseif page.summary != page.content %}
    {{ page.summary }}
{% else %}
    {{ page.content }}
{% endif %}

Of course you do all of this in a child theme using inheritance…

1 Like
#7

Works perfect! Thank you once again!

#8

@Morticai I just wondered… You are probably not the first wanting to display page content without the summary. Google comes to the rescue…

Displaying page content without summary

1 Like