Skip to content

Commit

Permalink
Adjusted JSON output to suit Grav versions > 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-j-m committed Sep 6, 2019
1 parent 2f010f6 commit 2df584f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v1.0.1
## 06-09-2019

1. [](#improved)
* Get language defined in page frontmatter with fallbacks to active language then default language
1. [](#bugfix)
* Adjusted JSON output to suit Grav versions > 1.5

# v1.0.0
## 21-08-2019

Expand Down
16 changes: 12 additions & 4 deletions aura.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ private function init($page)
if ((isset($header->aura['description'])) && ($header->aura['description'] != '')) {
$this->webpage->description = (string)$header->aura['description'];
}
$this->webpage->language = $this->grav['language']->getActive();
if (!$this->webpage->language) {
$this->webpage->language = $this->grav['config']->get('site.default_lang');
if ((isset($header->language)) and ($header->language != '')) {
$this->webpage->language = $header->language;
} else {
$this->webpage->language = $this->grav['language']->getActive();
if (!$this->webpage->language) {
$this->webpage->language = $this->grav['config']->get('site.default_lang');
}
}
$this->webpage->datePublished = date("c", $page->date());
$this->webpage->dateModified = date("c", $page->modified());
Expand Down Expand Up @@ -242,7 +246,11 @@ public function onPageInitialized()
// Generate structured data block
$sd = $this->generateStructuredData();
// Drop into JS pipeline
$assets->addInlineJs($sd, null, null, 'application/ld+json');
$type = array('type' => 'application/ld+json');
if (version_compare(GRAV_VERSION, '1.6.0', '<')) {
$type = 'application/ld+json';
}
$assets->addInlineJs($sd, null, null, $type);
}

}
Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Aura
version: 1.0.0
version: 1.0.1
description: Automatically add meta tags and structured data to your pages for visually appealing and informative search results and social media sharing.
icon: code
author:
Expand Down

0 comments on commit 2df584f

Please sign in to comment.