Plans & Pricing

Drupal Paragraphs Hold the Data, Canvas Does the Design

Add us as a preferred source on Google
A gray cat pins index cards onto a blank canvas on an easel by a sunny window, beside the headline Paragraphs Inside Canvas, with one View and no add-on.

In January, a long-time Drupal developer asked on Reddit how Canvas works "together with or in opposition to" Layout Builder, Paragraphs, Twig and single directory components (r/drupal thread). One commenter mentioned a Views block with a contextual filter, but nobody laid out the whole setup.

Here's mine. Give each tool its own job. Paragraphs holds the items that belong to one page, like a program's weekly sessions. Canvas handles the layout around them.

The catch is that a Canvas content template replaces the whole page display. If the template doesn't include your paragraphs, visitors stop seeing them. One View fixes that, with no add-on module.

I built everything here on a throwaway test site running Drupal CMS 2.2.7, Drupal core 11.4.11, Canvas 1.12.0 and Paragraphs 8.x-1.23. In this post, I'll show you how to decide what goes where, and how to put your paragraphs inside a Canvas template with nothing but a View.


What you need before you start

A few screens below come from Drupal CMS. Its front-end theme is called Mercury. That's a theme, and it has nothing to do with the Mercury Editor module.


Step 1. Decide what goes where

Sort everything on your pages into three piles, not two.

Paragraphs

Sets of fields that belong to one page and nowhere else.

  • A program's sessions (day, time, location, leader)
  • An event's schedule rows
  • A product's pricing tiers

This is the job the old Field Collection module did in Drupal 7. Its project page points Drupal 8 and later sites to Paragraphs with Entity Reference Revisions, or to ECK with Inline Entity Form.

Their own content type, linked with an entity reference

Anything shared or listed on its own.

  • Staff
  • Sponsors
  • FAQ items
  • Locations

A paragraph belongs to one page. It has no URL of its own, and it can't be shared between pages unless you add the Paragraphs Library. So shared items don't fit there.

Canvas

The layout. Heroes, banners, columns and the order of sections all go here.

My test for each item is simple. Does it belong to one page, or will other pages want it too? One page means Paragraphs. Many pages means its own content type.

There's a fair case for the other view. The Paragraphs project page pitches it as a way to build pages, and Layout Paragraphs and Mercury Editor build whole pages with it. That works. On a Canvas site, though, it leaves you with two page builders. Keep the layout in Canvas.

One more rule. Anything typed straight into a component on a Canvas page can't be filtered or sorted in Views. If you'll ever need to list or sort it, put it in a real field.

For flat rows like these sessions, the Custom Field module is a fair alternative. It stores several columns in one field, with no extra entity per row.

How to tell it worked

Every paragraph type you have fits in one of the three piles, and none of your paragraph types holds a "background color" or "columns" setting.


Step 2. Build the paragraph type

My example is a Program content type that needs a list of weekly sessions.

  1. Go to /admin/structure/paragraphs_type and click + Add paragraph type.
  2. Set the Label to "Session" and click Save and manage fields.
  3. Click + Create a new field, pick Plain text, type the label "Day", choose Short text, and click Continue, then Save.
  4. Repeat for "Time", "Location" and "Leader".
  5. Edit the Day field, tick Required field, and click Save settings. Every session needs a day, and the UI Patterns route in Step 4 builds each card from it.

The Manage fields screen for the Session paragraph type, listing Day, Leader, Location and Time, each a Short text field.

Keep layout settings out of the paragraph. No background color, no column count. Canvas handles that.

If your leaders also appear on a staff page, make Leader an entity reference to a Staff content type instead. That's the Step 1 test again. And if you'll ever sort sessions by weekday, make Day a Selection list instead of plain text.

Now add the paragraphs to the Program type:

  1. Go to /admin/structure/types/manage/program/fields and click + Create a new field.
  2. Pick Paragraphs, type the label "Sessions", and click Continue.
  3. Leave Allowed number of values at Unlimited.
  4. Under Which Paragraph types should be allowed?, keep Include the selected below and tick Session. Click Save.

The Sessions field settings for the Program content type, with Include the selected below chosen and only the Session paragraph type ticked.

How to tell it worked

Edit any Program. You'll see an Add Session button, and each session you add has Day, Time, Location and Leader boxes.

The edit form for the Community Food Pantry program, showing two Session paragraphs with Day, Time, Location and Leader filled in.


Step 3. Put the paragraphs in the Canvas template with a View

This is the step none of the top search results show you. A Canvas content template can't place a Paragraphs field directly. A View can, and Canvas will place the View.

Build the View

  1. Go to /admin/structure/views/add.
  2. Set View name to "Program sessions". Under Show, choose Content of type Program.
  3. Tick Create a block. Set Block title to "Sessions" and the display format to Unformatted list of fields. Click Save and edit.
  4. Under Fields, click Add. Search for "Sessions", tick it, and click Add and configure fields.
  5. Set Formatter to Rendered entity and View mode to Default.
  6. Open Multiple field settings and clear the Separator box. If you skip this, a stray comma shows up between sessions.
  7. Click Apply. Then remove the Content: Title field, because the template shows the title.
  8. Under Filter criteria, remove Content: Published (= Yes) and add Published status or admin user instead. Without this, editors see an empty block on an unpublished Program.
  9. If your site is translated, also add the Translation language filter and choose Content language selected for page. Otherwise each session can show once per translation.

The Views dialog Configure field: Content: Sessions, with Formatter set to Rendered entity and View mode set to Default.

Now tell the View which Program it's on:

  1. Next to Contextual filters, click Add.
  2. Search for "ID", tick the ID row in the Content category, and click Add and configure contextual filters.
  3. Under When the filter value is NOT available, choose Provide default value.
  4. Set Type to Content ID from URL. Click Apply, then Save.

The Views dialog Configure contextual filter: Content: ID, with Provide default value selected and Type set to Content ID from URL.

How to tell it worked

Type a Program's node ID into Preview with contextual filters and click Update preview. You'll see only that Program's sessions.

Place it in the template

  1. Open the Canvas editor at /canvas and click Templates in the left rail.
  2. Under Content types, open Program and click Full content template. If Program isn't listed, click New content template, pick Program as the Content type and Full content as the Template, then click Add new template. A new template starts empty, so add a heading for the title too.
  3. Open the Library. Your View is under Lists (Views) as "Program sessions". Open its menu and click Insert.
  4. Click Review 1 change, tick Select All, and click Publish 1 selected.

The Canvas editor with the Program full content template open, the Program sessions block inserted under the title, and the Library open at Lists (Views).

I wondered whether the block would show up empty in the template preview. It doesn't. Canvas previews the template with a real Program, which you pick at the top of the editor, and the block shows that Program's sessions.

How to tell it worked

Log out, or open a private window, and visit a Program page. Every session shows, in the order editors put them.

The Community Food Pantry program page viewed by a logged-out visitor, showing all three sessions with their day, time, location and leader.

I also changed one session's time and saved the Program. The logged-out page showed the new time on the next load.

Or let an AI assistant build Steps 2 and 3

If you use an AI coding assistant that can run Drush, such as Claude Code or Cursor, you can hand it this setup instead of clicking through it. To test that, I deleted the Session type, the Sessions field and the View from our test site and gave Claude Code the prompt below. It rebuilt all three, and the block showed a test Program's session.

You're working on a test copy of my Drupal site, never the live site. You can run Drush. Before you change anything, check that the Paragraphs module is on and that a Program content type exists, and stop and tell me if either is missing. Don't install any module and don't touch the Canvas templates.
1. Create a paragraph type called Session (machine name session) with four plain short text fields: Day (field_day, required), Time (field_time), Location (field_location) and Leader (field_leader). Add all four to its form display and its default view display.
2. Add a Paragraphs field called Sessions (field_sessions) to the Program content type. Allow unlimited values and only the Session paragraph type. Add it to Program's form display.
3. Create a View called Program sessions (machine name program_sessions) with one block display whose title is Sessions. It shows Content of type Program as an unformatted list of fields. Its only field is Content: Sessions, with the Rendered entity formatter, the Default view mode and an empty separator. Use the "Published status or admin user" filter instead of the plain Published filter. Add a contextual filter on Content: ID whose default value is "Content ID from URL". Leave the View's tag empty. Canvas keeps blocks from Views tagged "default" out of its Library.
4. Clear the cache. Then check that Canvas has an enabled component for the new block (block.views_block.program_sessions-block_1). Canvas can save it as disabled if it saw the View before you finished, so enable it if it is disabled.
5. List what you created and tell me how to check each piece in the admin UI.

Step 4 of the prompt is there for a reason. On an early run, the View worked, but Canvas had saved its block as disabled, so it never showed up in the Library. Canvas sets that once, when it first sees the block. The prompt has the assistant check and switch it back on.

Placing the block in the Canvas template is still your job. Use the clicks under "Place it in the template" above. I left the template out of the prompt on purpose. It's only a few clicks, and a mistake there hides your content from every visitor.

Don't take the assistant's summary as proof. Check each piece with the "How to tell it worked" steps in this post.

Two limits of the View approach

  • The View always shows the published sessions. I saved a draft with a changed time on a site that uses content moderation. Its latest-version page, at /node/2/latest, still showed the published time. Review session changes on the edit form until Canvas can place the field directly.
  • The View reads the Program from the URL. If a Program's full display is shown on some other page, the block shows that page's sessions or none.

A fair alternative to adding the Sessions field to the View is a "Sessions" view mode on Program that shows only the Sessions field. Set the View's row style to show content in that view mode, and you skip the separator fix. I didn't test this one.

Why this works, for the developers reading: Canvas refuses blocks that need a required context. A Views contextual filter exposes an optional one, so the block is allowed.


Step 4. Give paragraphs the same look as your Canvas components

Right now the sessions render as plain labeled fields. Build the design once as a single directory component (SDC), which is a folder holding a component's template, styles and settings. It shows up in the Canvas Library, and your paragraphs can render through it too.

If your theme is Mercury, copy it first

The component and the Twig template below go in your own theme. If your front-end theme is Drupal CMS's Mercury, read its CUSTOMIZING.md first. It says "Don't subtheme Mercury!" and tells you to copy it to web/themes/custom/mercury and run composer remove drupal/mercury. On our test site, that command also removed the CVA module, which Mercury needs and which was still turned on. Require CVA yourself first, then remove the Mercury package:

composer require 'drupal/cva:^1'
composer remove drupal/mercury

Then delete the lines under "Information added by Drupal.org packaging script" at the bottom of the copied mercury.info.yml. Those version and project lines make the Available updates report keep treating your copy as the drupal.org project.

If you'd rather not copy Mercury at all, keep the component and the template in a custom module instead. Our test site does that for another paragraph type. A module template needs a hook_theme() entry that names paragraph as its base hook.

Build the component

I built one at components/session-card/session-card.component.yml in the theme. A session-card.twig and a session-card.css sit in the same folder.

$schema: https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas/v1/metadata.schema.json
name: Session card
description: One meeting of a program, with its day, time, place and leader.
group: Example Nonprofit
props:
  type: object
  required:
    - day
  properties:
    day:
      type: string
      title: Day
      examples:
        - Tuesday
    time:
      type: string
      title: Time
      examples:
        - 4:00 to 6:30 PM
    location:
      type: string
      title: Location
      examples:
        - Fellowship Hall, 120 Main Street
    leader:
      type: string
      title: Leader
      examples:
        - Dana Ortiz

Here's session-card.twig:

<article{{ attributes.addClass('session-card') }}>
  <h3 class="session-card__day">{{ day }}</h3>
  <dl class="session-card__details">
    {% if time %}
      <dt>Time</dt><dd>{{ time }}</dd>
    {% endif %}
    {% if location %}
      <dt>Where</dt><dd>{{ location }}</dd>
    {% endif %}
    {% if leader %}
      <dt>Leader</dt><dd>{{ leader }}</dd>
    {% endif %}
  </dl>
</article>

The CSS file is up to you. Mine adds a border, a colored left edge and a two-column grid for the details.

The Canvas Library filtered by Session, showing Session card under Example Nonprofit and Program sessions under Lists (Views), with the template preview showing styled session cards.

Then connect the paragraph to it. I tested two ways.

The no-code way, with UI Patterns 2

UI Patterns 2.0.23 adds component formatters to Manage display.

composer require 'drupal/ui_patterns:^2.0'
drush en ui_patterns ui_patterns_field_formatters
  1. Go to /admin/structure/paragraphs_type/session/display/default.
  2. Set the Day field's format to Component per item (UI Patterns) and open its settings.
  3. Set Component to Session card.
  4. For the Day prop, click Change source and choose [Field item] Text value.
  5. For Time, Location and Leader, choose [Entity] ➜ [Field], pick the matching Field, then choose [Field item] Text value. Click Save under each one.
  6. Click Update. Hide the Day label, move Time, Location and Leader to Disabled, and click Save.

The UI Patterns settings for the Session card component, with the Time prop using the [Entity] ➜ [Field] source, Field set to Time and Source set to [Field item] Text value.

One thing to watch. When I turned UI Patterns on, Mercury's header started showing two placeholder buttons labeled "Button" and "Another". They went away when I uninstalled it. Those buttons are the default content of the navbar's links slot, which shows when that slot comes through empty. Check your header on the test copy before you go further.

The code way, with a Twig template in your theme

Save this as paragraph--session.html.twig in your theme's templates folder, then run drush cr. No hook is needed when the template lives in the theme.

{#
/**
 * @file
 * Session paragraph, rendered through the session-card component.
 */
#}
{% set rendered_content = content|render %}
{{ include('mercury:session-card', {
  day: paragraph.field_day.value,
  time: paragraph.field_time.value,
  location: paragraph.field_location.value,
  leader: paragraph.field_leader.value,
  attributes: attributes,
}, with_context = false) }}

Change mercury to your theme's machine name. Three things to know:

  • Render content even though you don't print it. The rendered_content line makes sure the cache data from content still bubbles up to the page.
  • Use .value only for short plain text, like these four fields. It skips Manage display and field access checks. On a plain long text field it drops the line breaks, and on a formatted text field visitors see the raw HTML tags.
  • For a link field, use getUrl().toString(). A link item stores only its uri, title and options, so there's no url to read. On our test site, field.0.url.toString() came back empty, while getUrl().toString() returned /donate.

How to tell it worked

Visit a Program page logged out. Each session shows as a card, and the same Session card is in the Canvas Library for your editors.

I'd pick the Twig template. It's a few lines of code, and it adds no module that changes how other components render.


The trap. Publishing a template drops your paragraphs

A Canvas content template replaces the node's whole display. If the template doesn't include the paragraphs, visitors lose them. Editors keep filling in sessions on the edit form and never see why they aren't showing.

This is the same Program page with a published template that holds only the title.

The Community Food Pantry program page with a published Canvas template that holds only the title, so none of the sessions show.

The fix is Step 3. To check your own site, open the Canvas editor, click Templates, and open each template for a content type that has a Paragraphs field. If you don't see a block for the paragraphs, visitors don't see them either.

There's a related open Canvas issue about linking component props to fields inside paragraphs (issue 3583186). It's about mapping props, not about showing the field, so the View is still the fix today.


Add-on modules, and when you'd want one

I tried the three add-ons Google lists for this. Each one worked on the test site.

ModuleWhat it doesStatus on drupal.org (October 2026)
Canvas Paragraphs 1.0.0-alpha2Gives each paragraph type its own Canvas templateExperimental, 9 sites, no security coverage
Paragraphs Components AI for Canvas 1.0.2Places reusable Paragraphs Library items on Canvas pagesCovered, 14 sites
Paragraph SDC 2.0.1Places any entity on a page by typing its IDMinimally maintained, not covered, 78 sites
  • Canvas Paragraphs needs one sample paragraph of each type before the editor previews, and its README says it can create that sample for you. It also covers taxonomy terms, and it turns on the Navigation and Taxonomy modules as dependencies. Keep it on a test copy for now.
  • Paragraphs Components is a different model. Your content has to live in the Paragraphs Library, not on the node. You also have to install Entity Usage by hand, because the Paragraphs Library needs it and Composer doesn't pull it in.
  • Paragraph SDC needs Twig Tweak. Typing IDs into a page is fragile, and its routing file adds a /paragraph/{paragraph} page for each paragraph, open to anyone with view access. That can expose a thin standalone page for every paragraph, so I wouldn't use it.

For most sites, the View in Step 3 does the job with no add-on at all.


What's coming in Canvas

  • Paragraph types as Canvas components. Issue 3517216 is accepted, with an open merge request that was last updated in April and hasn't been merged. Its working name is also "canvas_paragraphs", but it isn't the add-on above.
  • Exposed slots. These let a locked template keep one open area that editors fill on each page (issue 3591817). The work is split into six merge requests under review, and none of them is in 1.12.0. Its storage change is marked as breaking, so details may move. Someone posted a demo on Reddit on October 16.
  • Canvas on any entity type. That's tracked in issue 3498525.

Until those are in a release, Step 3 is the way to do it.


What to do this week

  1. Sort your paragraph types into the three piles from Step 1.
  2. Move anything shared, like staff or sponsors, into its own content type.
  3. Open every Canvas template for a content type with a Paragraphs field, and check that something shows the paragraphs.
  4. On a test copy, build the View from Step 3 and place it in the template.
  5. Log out and check a page of each type.

Want someone else to review your content model and set this up? Get in touch with Drupal Aid.


Sources


About the Author

Bob Kruse is the founder of Drupal Aid and a Drupal fanatic since 2008. Drupal Aid has provided Drupal maintenance and security support since 2014. Read more about Drupal Aid or contact us.


Get our best Drupal advice first

Each week we send 1 email to smart Drupal website owners.

We will not share your email. Privacy policy

Comments

Have a question about this update? Ask it here.

Keep reading

See all posts →
Enhancing CKEditor in Drupal 8

Enhancing CKEditor in Drupal 8

It was a happy day for me when CKeditor was incorporated into Drupal 8 core. Out of the box, Ckeditor is great.