oliverdavies.uk/content/node.98e6a250-a27f-41c2-8685-e80474a2d174.yml

76 lines
3 KiB
YAML

uuid:
- value: 98e6a250-a27f-41c2-8685-e80474a2d174
langcode:
- value: en
type:
- target_id: daily_email
target_type: node_type
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
revision_timestamp:
- value: '2025-05-11T09:00:12+00:00'
revision_uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
revision_log: { }
status:
- value: true
uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
title:
- value: "Don't put HTML in your body field"
created:
- value: '2024-05-24T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:12+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2024/05/24/dont-put-html-in-your-body-field
langcode: en
body:
- value: |
<p>I often see Drupal projects where people have put raw HTML code into their body or other rich-text fields.</p>
<p>Whilst it can be useful for short-term prototyping, I don't think it should be done for content that will be reused or kept for a period of time.</p>
<p>If you have structured HTML code in multiple nodes, you can't make changes without editing each instance.</p>
<p>What if you need to fix a bug and have hundreds or thousands of instances?</p>
<p>If you have inline styles, they won't be updated or affected by changes to your stylesheets, such as changing colour or font family.</p>
<p>Instead, create first-class components that use templates that are easier to change and maintain and have a single source of truth that adheres to your design system.</p>
<p>In Drupal, use structured data in fields with Paragraphs or Layout Builder and build the templates around them.</p>
<p>This makes it easier to maintain and also for people to add and edit content.</p>
format: full_html
processed: |
<p>I often see Drupal projects where people have put raw HTML code into their body or other rich-text fields.</p>
<p>Whilst it can be useful for short-term prototyping, I don't think it should be done for content that will be reused or kept for a period of time.</p>
<p>If you have structured HTML code in multiple nodes, you can't make changes without editing each instance.</p>
<p>What if you need to fix a bug and have hundreds or thousands of instances?</p>
<p>If you have inline styles, they won't be updated or affected by changes to your stylesheets, such as changing colour or font family.</p>
<p>Instead, create first-class components that use templates that are easier to change and maintain and have a single source of truth that adheres to your design system.</p>
<p>In Drupal, use structured data in fields with Paragraphs or Layout Builder and build the templates around them.</p>
<p>This makes it easier to maintain and also for people to add and edit content.</p>
summary: null
field_daily_email_cta: { }