This threw me for a minute, the demo.content.yml has this example, which was throwing and error when I tried to run it:

# Add a basic article page with simple values.
- entity: "node"
  type: "article"
  title: "Basic Article"
  status: 1
  # Rich text fields contain multiple keys that must be provided.
  body:
    format: "full_html"
    # Using a pipe we can define content across multiple lines.
    value: |
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vobis
      voluptatum perceptarum recordatio vitam beatam facit, et quidem corpore
      perceptarum. Tum Quintus: Est plane, Piso, ut dicis, inquit.</p>
      <p>Primum cur ista res digna odio est, nisi quod est turpis? Duo Reges:
      constructio interrete. Rhetorice igitur, inquam, nos mavis quam
      dialectice disputare?</p>

This is the error:

InvalidArgumentException: 'body' cannot hold more than 1 values. 2 values were parsed from the YAML file.

I see in a more recent article you posted (https://www.mediacurrent.com/blog/creating-content-yaml-content-module) that the YAML is wrong for the body, and it should be like this (notice the extra "-" and indentation):

# Add a basic article page with simple values.
- entity: "node"
  type: "article"
  title: "Basic Article"
  status: 1
  # Rich text fields contain multiple keys that must be provided.
  body:
    - format: "full_html"
      # Using a pipe we can define content across multiple lines.
      value: |
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vobis
        voluptatum perceptarum recordatio vitam beatam facit, et quidem corpore
        perceptarum. Tum Quintus: Est plane, Piso, ut dicis, inquit.</p>
        <p>Primum cur ista res digna odio est, nisi quod est turpis? Duo Reges:
        constructio interrete. Rhetorice igitur, inquam, nos mavis quam
        dialectice disputare?</p>

Also, instead of "full_html" on my D8 install we have the "rich_text" format by default - not sure if that's the Lightning install profile default or what, but it could be worth mentioning in a comment. Thanks!

Comments

thaddeusmt created an issue. See original summary.

slucero’s picture

Thanks for both reporting this and even more-so for digging in and figuring out the issue! I'll be looking into this and getting it patched into the dev version ASAP.

  • slucero authored 3a3e303 on 8.x-1.x
    Issue #2897985 by thaddeusmt, slucero: Bug in YAML example demo.content....
slucero’s picture

Status: Active » Fixed

I've pushed a fix for this into the dev branch so it can be included in the next alpha release (8.x-1.0-alpha4). This fix both fixed the formatting for body field values in the demo content file and added some contextual comments regarding the body filter value.

Also, instead of "full_html" on my D8 install we have the "rich_text" format by default - not sure if that's the Lightning install profile default or what, but it could be worth mentioning in a comment.

To confirm, yes this discrepancy is a result of using the Lightning profile instead of the Standard installation profile. Lightning installs a filter called rich_text which may be seen here. To clarify this a bit though, I have added comments above the filter lines mentioning that any configured filter may be used.

Thanks again for reporting this!

slucero’s picture

Version: 8.x-1.x-dev » 8.x-1.0-alpha3

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.