Skip to content

Commit

Permalink
Merge branch 'release/2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Dec 9, 2021
2 parents 7c2e54c + ac9e121 commit 40861ff
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v2.1.1
## 12/09/2021

1. [](#improved)
* Added a modular example in the README.md
2. [](#bugfix)
* Allow null returned by `getInjectedPageContent()`

# v2.1.0
## 12/06/2021

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ And for page-injection, you can specify a custom Twig template to render with:
[page-inject path="/route/to/page" template="foo" /]
```

## Modular Pages

One of the most useful scenarios for using Page Inject plugin is for pulling modular pages into your content. This is because it allows you to sprinkle structure, pre-rendered HTML into the middle of your content. This allows you to create complex content layouts with a combination of straight markdown content, with blocks of more structured output. For example imagine being able to display a "Contact Us" form in the middle of a case study. Or perhaps a customer quotes module in the middle of a long article about your customer success stories. A quick example of this might be:

```markdown
[plugin:page-inject](/modular/_callout)
```

The path will be the **Page route** for the page, and modular pages are typically distinguished by the `_` prefix. You would typically want to use a **page-inject** for this as you want the modular page pre-rendered with the associated Twig template. You could still just display the content with **content-inject**.

## Remote Injects

It is now possible to retrieve remote content from another Grav instance as long as both of the sites are running the latest version of the `page-inject` plugin. First in the **client** Grav instance you need to define a remote connection to another Grav **server** in the plugin configuration. For example:
Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Page Inject
type: plugin
slug: page-inject
version: 2.1.0
version: 2.1.1
description: "**Page Inject** is a powerful plugin that lets you inject entire pages or page content into other pages using simple markdown-style or shortcode syntax"
icon: trello
author:
Expand Down
2 changes: 1 addition & 1 deletion page-inject.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function registerNextGenEditorPlugin($event) {
return $event;
}

public static function getInjectedPageContent($type, $path, $page = null, $processed_content = null): string
public static function getInjectedPageContent($type, $path, $page = null, $processed_content = null): ?string
{
$pages = Grav::instance()['pages'];
$page = $page ?? Grav::instance()['page'];
Expand Down

0 comments on commit 40861ff

Please sign in to comment.