Grav: StartTag: invalid element name

Created on 2 Sep 2016  路  8Comments  路  Source: getgrav/grav

I haven't touched any code in grav in a few days... I've added maybe 7 or 8 pages and all of a sudden after going to one [only one] of my four menu items I get:

Twig_Error_Runtime An exception has been thrown during the rendering of a template ("DOMDocumentFragment::appendXML(): Entity: line 1: parser error : StartTag: invalid element name") in "partials/blog_item.html.twig" at line 53.

I'm running antimatter commit 5d98b400a and grav commit 7843b307963 (1.1.3).

sudo -u www-data bin/composer.phar diagnose                 
Checking composer.json: FAIL
require.erusev/parsedown : unbound version constraints (dev-master as 1.6.0) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: Warning: Accessing packagist.org over http which is an insecure protocol.
OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
investigating more info needed

All 8 comments

The only place I can think of that DomDocument is used is in the Truncator class. This is used to truncate HTML and is used by Page::summary(). This makes total sense as your error references partials/blog_item.html.twig which does have a call to page.summary.

Ok, that said, the Truncator tries to close any open tags that occur at the truncation point. This is usually very solid, and i've not really found a scenario that breaks it, but clearly you have!

A quick workaround is if you know the page which is causing this problem, use a manual summary seperator rather than letting it use the character limit (from site.yaml). Another option is to tweak the summary size in site.yaml. Try 10 or 20 chars smaller or larger, see if it makes a difference.

More Info: https://learn.getgrav.org/content/content-pages#summary-size-and-separator

I would love to get the actual page that is causing this, but that obviously is not easy to track down. If you do know the page, or can find out which one is causing it, can you provide me an exact copy of this page, plus your site.yaml configuration so I can try to replicate it???

Found the culprit. I changed the character limit in site.yaml from 300 to 200 but it made no difference. Here is the offender:

29.quinled/item.md

title: QuinLED
---

#### Power Supplies
Meanwell: IRM-60-12ST    $16.70 (10 @ 13.69)  <.1W no load
Mean Well IRM-60-12      $14.90 (10 @ 12.21)  <.1W no load
RPS-60-12                $14.00 (10 @ 12.13)  <.75W no load#

Here's my site.yaml:

title: sendthemtomir
author:
  name: 'Michael Bushey'
  email: [email protected]
taxonomies:
  - category
  - tag
  - month
metadata:
  description: 'Grav is an easy to use, yet powerful, open source flat-file CMS'
summary:
  enabled: true
  format: short
  size: 300
  delimiter: '==='
redirects:
  /changelog: /blog/the-urban-jungle
routes:
  /something/else: /blog/focus-and-blur
  '/another/one/(.*)': /blog/$1
blog:
  route: ''

Thanks, it's definitely those < symbols that are causing the problem. I'll see what can be done.

Ok, step 1, replicated locally!

Ok, had to rewrite the Truncator completely, but i think this is good!

Fixed (in Grav 1.1.5) here too. After upgrading I got a "Class 'DOMLettersIterator' not found" but bin/composer.phar update fixed it. Thanks for the awesome support and amazing CMS!

please help to solve this

https://del.dog/yudebitawa

Was this page helpful?
0 / 5 - 0 ratings