diff --git a/source/_daily_emails/2024-05-24.md b/source/_daily_emails/2024-05-24.md new file mode 100644 index 00000000..0646043c --- /dev/null +++ b/source/_daily_emails/2024-05-24.md @@ -0,0 +1,27 @@ +--- +title: Don't put HTML in your body field +date: 2024-05-24 +permalink: daily/2024/05/24/dont-put-html-in-your-body-field +tags: + - software-development + - drupal +cta: d7eol +snippet: | + Do you put raw HTML code in your rich-text fields? +--- + +I often see Drupal projects where people have put raw HTML code into their body or other rich-text fields. + +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. + +If you have structured HTML code in multiple nodes, you can't make changes without editing each instance. + +What if you need to fix a bug and have hundreds or thousands of instances? + +If you have inline styles, they won't be updated or affected by changes to your stylesheets, such as changing colour or font family. + +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. + +In Drupal, use structured data in fields with Paragraphs or Layout Builder and build the templates around them. + +This makes it easier to maintain and also for people to add and edit content.