Score:-1

How to embed content from one place inside two or more nodes?

vi flag

There is some content (a list of data) which I need to embed/call inside the main content area of two or more nodes.

Calling data from location A inside location B and C or more.

Something similar to an "include" in PHP.

So, if any change is needed to be done to the embedded content, it would be done in one place only and effect all places in which it is embedded.

The content I need to embed would be in the same website (in the same database).

I don't mind where to put/store the content I embed --- it can be in another node or in a view or in a block (or in any other content-structure available in Drupal that would be good for the cause).

It doesn't matter to me how to do the embedding (I would even use <iframe> if I must), but, I would prefer not to install a module if I can.

How would you suggest to do that in Drupal?

cn flag
This question is way too vague. What are you actually trying to do specifically? A view can easily contain nodes (even specific nodes in the header and footer), and you can add an entity reference node to link nodes with each other.
menos avatar
vi flag
I am having a hard time explaining what I am trying to do but I have tried to re-phrase the question from the ground up.
menos avatar
vi flag
I want to embed the content inside a node --- inside the main content area, not around it...
Score:0
cn flag

You can put a list in a block. If there is more than one list, you can create multiple blocks.

Then Entity Embed will let you embed the blocks wherever you want using CKEditor.

Score:0
cn flag

If you want to do a custom design for specific nodes, use Layout Builder. You can create an override for each node that you want to have a unique design and then set the blocks however you like.

Layout Builder is included in Drupal as standard and is fully supported by the core team, so it is the recommended approach for doing basic custom designs.

menos avatar
vi flag
Are you saying that one could add blocks into nodes layouted with Layout Builder?
cn flag
Blocks are entities, and you can add any entity to another with Layout Builder. The advantage of using Layout Builder is that you can configure the order of the blocks and their layout on the page for each node separately.
Score:-1
vi flag

Adding on Patrick Kenny's great (and conventional) answer, another way I have found to do it is to create a content type that doesn't have any fields and which its nodes are comprised of blocks.

  1. Create a content type and name it as, for example, "No fields content type".
  2. Create a node of that content type.
  3. Create new custom blocks and then add these blocks in the desired order and limit them to appear in each node of that content type as you wish

This method is generally inefficient and should not be used for more than 1-5 nodes because it can cause extremely long and possibly duplicated and confusing block lists.

cn flag
No, don't do that-- you are working against the system. If you need a custom design for a node, use Layout Builder. See my second answer.
Kevin avatar
in flag
Do not do this, it is abusing the content type system and creates way too much overhead.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.