You are here

demo.content.yml in YAML Content 8

Same filename and directory in other branches
  1. 8.2 content/demo.content.yml
content/demo.content.yml

File

content/demo.content.yml
View source
  1. # Demonstration content for interrelated imports.
  2. ---
  3. # Add taxonomy terms to be referenced from later content.
  4. # All top-level array items must be separate entities for import.
  5. - entity: "taxonomy_term"
  6. vid: "tags"
  7. name: "Generated content"
  8. - entity: "taxonomy_term"
  9. vid: "tags"
  10. name: "Imported demo content"
  11. # Add a basic article page with simple values.
  12. - entity: "node"
  13. type: "article"
  14. title: "Basic Article"
  15. status: 1
  16. # Assumes Pathauto is installed.
  17. path:
  18. - pathauto: 0
  19. alias: '/articles/a-basic-article'
  20. # Rich text fields contain multiple keys that must be provided.
  21. body:
  22. # The format may be the machine name of any configured text filter.
  23. - format: "full_html"
  24. # Using a pipe we can define content across multiple lines.
  25. value: |
  26. <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vobis
  27. voluptatum perceptarum recordatio vitam beatam facit, et quidem corpore
  28. perceptarum. Tum Quintus: Est plane, Piso, ut dicis, inquit.</p>
  29. <p>Primum cur ista res digna odio est, nisi quod est turpis? Duo Reges:
  30. constructio interrete. Rhetorice igitur, inquam, nos mavis quam
  31. dialectice disputare?</p>
  32. # Articles may also be more complex and include referenced content like tags.
  33. - entity: "node"
  34. type: "article"
  35. title: "Tagged Article"
  36. status: 1
  37. body:
  38. # The format may be the machine name of any configured text filter.
  39. - format: "full_html"
  40. # Using a pipe we can define content across multiple lines.
  41. value: |
  42. <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vobis
  43. voluptatum perceptarum recordatio vitam beatam facit, et quidem corpore
  44. perceptarum. Tum Quintus: Est plane, Piso, ut dicis, inquit.Primum cur
  45. ista res digna odio est, nisi quod est turpis? Duo Reges: constructio
  46. interrete. Rhetorice igitur, inquam, nos mavis quam dialectice disputare?</p>
  47. # Since the tags to be used were created above, we don't know their IDs and have to look them up dynamically.
  48. field_tags:
  49. # This is done via a preprocessor.
  50. - '#process':
  51. # First we designate the processor callback to be used.
  52. callback: 'reference'
  53. # Each callback may require a set of arguments to configure its behavior.
  54. args:
  55. # Indicate the machine name of the entity type to be referenced.
  56. - 'taxonomy_term'
  57. # Provide a list of conditions to filter the content matches.
  58. # Each property filter maps directly to an EntityQuery condition.
  59. - vid: 'tags'
  60. name: 'Generated content'
  61. # Processors may be called multiple times to fill in any content requirements.
  62. - '#process':
  63. callback: 'reference'
  64. args:
  65. - 'taxonomy_term'
  66. - vid: 'tags'
  67. name: 'Imported demo content'
  68. # Files like images can even be referenced and added within content.
  69. - entity: "node"
  70. type: "article"
  71. title: "Article with an Image"
  72. status: 1
  73. body:
  74. # The format may be the machine name of any configured text filter.
  75. - format: "full_html"
  76. # Using a pipe we can define content across multiple lines.
  77. value: |
  78. <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed vobis
  79. voluptatum perceptarum recordatio vitam beatam facit, et quidem corpore
  80. perceptarum. Tum Quintus: Est plane, Piso, ut dicis, inquit.Primum cur
  81. ista res digna odio est, nisi quod est turpis? Duo Reges: constructio
  82. interrete. Rhetorice igitur, inquam, nos mavis quam dialectice disputare?</p>
  83. field_tags:
  84. - '#process':
  85. callback: 'reference'
  86. args:
  87. - 'taxonomy_term'
  88. - vid: 'tags'
  89. name: 'Generated content'
  90. field_image:
  91. # To lookup and add files we'll need to use a different callback function.
  92. - '#process':
  93. # In this case we're looking up a file, so we'll use the `file` callback.
  94. callback: 'file'
  95. args:
  96. # Our first argument is, again, the bundle of the entity type.
  97. - 'image'
  98. # For this callback our additional arguments are telling what file we want.
  99. # By default, images are searched for within an `images` directory beside the
  100. # `content` directory containing our content files.
  101. - filename: 'demo-image.jpg'