This module allows you to insert relevant articles directly into the content of other articles. You can either manually place these related posts using a CKEditor plugin or have them automatically inserted based on text length.
INTRODUCTION
A way to add relevant articles in the middle of content.
INSTALLATION
Install as you would normally install a contributed Drupal module. See: https://www.drupal.org/node/895232 for further information.
CONFIGURATION
A way to add relevant articles defined in link type field or entity reference using ief in the middle of content.
Check readme.md to see documentation
It needs to define the configuration in template_preprocess_node, as this:
use Drupal\inline_related_posts\Hook\InlineRelatedPostsThemeHooks;
your_theme_preprocess_node(&$variables) {
// Both automatic and manual mode
// bundle_host: The content bundle that allow inline related in its body.
$variables['related_posts_bundle_host'] = 'article';
// host_view_mode: The host view mode where to add inline related content.
$variables['related_posts_bundle_host_view_mode'] = 'full';
// host_related_links_field: The field that holds the related links in host entity.
$variables['related_posts_host_related_links_field'] = 'field_related_links';
// inline_view_mode: The view-mode used to render the related content.
$variables['related_posts_inline_view_mode'] = 'inline_related';
// Automatic mode only:
// paragraph_length: The length of paragraph to be surpassed to append inline related post.
$variables['related_posts_paragraph_length'] = 1000;
//It's mandatory to call the InlineRelatedPostsThemeHooks->preprocessNode after.
\Drupal::service(InlineRelatedPostsThemeHooks::class)->preprocessNode($variables);
}
It may be used as manual or automatic mode:
-
Manual: It must be used together with the ckeditor5 plugin, so you'll need to configure in text formats, to tell which field will be used as related links origin. Then when editing text you could place the slots that will be filled later.
-
Automatic: By now it doesn't have a configuration ui to define the paragraph length to be surpassed to append inline related post after, it should be done in
$variables['related_posts_paragraph_length'](see previous code example)
MAINTAINERS
Current maintainers for Drupal 10:
- Aleix Quintana Alsius (aleix) - https://www.drupal.org/u/aleix
Ask your assistant about Inline related posts
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.x-dev | Dev | 10–11 | Mar 3, 2025 |