diff --git a/CHANGELOG.md b/CHANGELOG.md index 3abc994..16694a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # SEOmatic Changelog +## 1.1.51 - 2017.09.21 +### Added +* Added support for `hreflang="x-default"` +* Added `availabilty` to the default `Offer` Product JSON-LD + +### Changed +* Fixed an issue where you could not change the Open Graph or Twitter `title` from a Twig template +* Handle localized elements for breadcrumbs + ## 1.1.50 - 2017.08.10 ### Added * Add the ability to override the canonicalUrl from an SEOmatic Meta FieldType diff --git a/DOCS.md b/DOCS.md index 2633c72..a6f0065 100755 --- a/DOCS.md +++ b/DOCS.md @@ -1185,6 +1185,39 @@ The `email` variable is ordinal-encoded to obfuscate it. For instance, `info@ny ## SEOmatic Helper Twig Variables +SEOmatic populates your templates with the following "helper" variables for that you can use in your templates: + + seomaticHelper.twitterUrl + seomaticHelper.facebookUrl + seomaticHelper.googlePlusUrl + seomaticHelper.linkedInUrl + seomaticHelper.youtubeUrl, + seomaticHelper.youtubeChannelUrl + seomaticHelper.instagramUrl + seomaticHelper.pinterestUrl + seomaticHelper.githubUrl + seomaticHelper.vimeoUrl + seomaticHelper.wikipediaUrl + seomaticHelper.ownerGoogleSiteVerification + seomaticHelper.ownerBingSiteVerification + seomaticHelper.ownerGoogleAnalyticsUID + seomaticHelper.ownerGoogleTagManagerID + seomaticHelper.googleAnalyticsSendPageview + seomaticHelper.googleAnalyticsAdvertising + seomaticHelper.googleAnalyticsEcommerce + seomaticHelper.googleAnalyticsEEcommerce + seomaticHelper.googleAnalyticsLinkAttribution + seomaticHelper.googleAnalyticsLinker + seomaticHelper.googleAnalyticsAnonymizeIp + seomaticHelper.ownerCopyrightNotice + seomaticHelper.ownerAddressString + seomaticHelper.ownerAddressHtml + seomaticHelper.ownerMapUrl + seomaticHelper.creatorCopyrightNotice + seomaticHelper.creatorAddressString + seomaticHelper.creatorAddressHtml + seomaticHelper.creatorMapUrl + ## Previewing your SEO Meta There's a lot going on here, so to make it all more easily understood, SEOmatic offers two ways to preview your SEO Meta. You have to **Save** the settings first before you preview them; a "Live Preview" feature is on the wish list for future versions. diff --git a/SeomaticPlugin.php b/SeomaticPlugin.php index 87ec0bf..ced0411 100755 --- a/SeomaticPlugin.php +++ b/SeomaticPlugin.php @@ -26,7 +26,7 @@ public function getReleaseFeedUrl() public function getVersion() { - return '1.1.50'; + return '1.1.51'; } public function getSchemaVersion() diff --git a/releases.json b/releases.json index c909dfc..75b1cfe 100644 --- a/releases.json +++ b/releases.json @@ -1,4 +1,15 @@ [ + { + "version": "1.1.51", + "downloadUrl": "https://github.com/nystudio107/seomatic/archive/master.zip", + "date": "2017-09-21T11:00:00-11:00", + "notes": [ + "[Fixed] Handle localized elements for breadcrumbs", + "[Added] Added support for `hreflang='x-default'`", + "[Fixed] Fixed an issue where you could not change the Open Graph or Twitter `title` from a Twig template", + "[Added] Added `availabilty` to the default `Offer` Product JSON-LD" + ] + }, { "version": "1.1.50", "downloadUrl": "https://github.com/nystudio107/seomatic/archive/master.zip", diff --git a/services/SeomaticService.php b/services/SeomaticService.php index 83d16aa..9802396 100644 --- a/services/SeomaticService.php +++ b/services/SeomaticService.php @@ -620,22 +620,34 @@ public function getMetaFromElement($element) foreach ($variants as $variant) { + if ($variant->getIsAvailable()) { + $availability = "http://schema.org/InStock"; + } else { + $availability = "http://schema.org/OutOfStock"; + } $commerceVariant = array( 'seoProductDescription' => $variant->getDescription() . ' - ' . $element->title, 'seoProductPrice' => number_format($variant->getPrice(), 2, '.', ''), 'seoProductCurrency' => craft()->commerce_paymentCurrencies->getPrimaryPaymentCurrency(), 'seoProductSku' => $variant->getSku(), + 'seoProductAvailability' => $availability, ); $commerceVariants[] = $commerceVariant; } } else { + if ($element->getIsAvailable()) { + $availability = "http://schema.org/InStock"; + } else { + $availability = "http://schema.org/OutOfStock"; + } $commerceVariant = array( 'seoProductDescription' => $element->getDescription() . ' - ' . $element->title, 'seoProductPrice' => number_format($element->getPrice(), 2, '.', ''), 'seoProductCurrency' => craft()->commerce_paymentCurrencies->getPrimaryPaymentCurrency(), 'seoProductSku' => $element->getSku(), + 'seoProductAvailability' => $availability, ); $commerceVariants[] = $commerceVariant; } @@ -1217,7 +1229,7 @@ public function getDefaultBreadcrumbs($meta) $result = array(); $element = null; - $element = craft()->elements->getElementByUri("__home__"); + $element = craft()->elements->getElementByUri("__home__", craft()->language, true); if ($element) { $result[$element->title] = $this->getFullyQualifiedUrl($element->url); @@ -1247,7 +1259,7 @@ public function getDefaultBreadcrumbs($meta) foreach ($segments as $segment) { $uri .= $segment; - $element = craft()->elements->getElementByUri($uri); + $element = craft()->elements->getElementByUri($uri, craft()->language, true); if ($element && $element->uri) { $result[$element->title] = $this->getFullyQualifiedUrl($element->uri); @@ -2374,6 +2386,7 @@ public function getProductJSONLD($meta, $identity, $locale) "priceCurrency" => $variant['seoProductCurrency'], "offeredBy" => $identity, "seller" => $identity, + "availability" => $variant['seoProductAvailability'], ); $offer = array_filter($offer); $productJSONLD['offers'] = $offer; @@ -2934,10 +2947,21 @@ public function sanitizeMetaVars(&$metaVars) if ($seomaticSiteMeta['siteSeoTitlePlacement'] == "after") $titleSuffix = " " . $seomaticSiteMeta['siteSeoTitleSeparator'] . " " . $seomaticSiteMeta['siteSeoName']; + if (isset($seomaticMeta['twitter']['title'])) { + $title = $seomaticMeta['twitter']['title']; + } else { + $title = $seomaticMeta['seoTitle']; + } if (isset($seomaticMeta['twitter'])) - $seomaticMeta['twitter']['title'] = $titlePrefix . $seomaticMeta['seoTitle'] . $titleSuffix; + $seomaticMeta['twitter']['title'] = $titlePrefix . $title . $titleSuffix; + + if (isset($seomaticMeta['og']['title'])) { + $title = $seomaticMeta['og']['title']; + } else { + $title = $seomaticMeta['seoTitle']; + } if (isset($seomaticMeta['og'])) - $seomaticMeta['og']['title'] = $titlePrefix . $seomaticMeta['seoTitle'] . $titleSuffix; + $seomaticMeta['og']['title'] = $titlePrefix . $title . $titleSuffix; /* -- Truncate seoTitle, seoDescription, and seoKeywords to recommended values */ diff --git a/templates/_seo_meta.twig b/templates/_seo_meta.twig index adb521d..38d4d03 100755 --- a/templates/_seo_meta.twig +++ b/templates/_seo_meta.twig @@ -20,6 +20,11 @@ {% endif %} {% set localizedUrls = getLocalizedUrls() %} +{% if localizedUrls |length > 0 %} + +{% else %} + +{% endif %} {% if localizedUrls |length > 1 %} {% for key, value in localizedUrls %} diff --git a/templates/_seo_metaPreview.twig b/templates/_seo_metaPreview.twig index 8e9835d..a6811bd 100755 --- a/templates/_seo_metaPreview.twig +++ b/templates/_seo_metaPreview.twig @@ -20,6 +20,11 @@ {% endif %} {% set localizedUrls = getLocalizedUrls() %} +{% if localizedUrls |length > 0 %} + +{% else %} + +{% endif %} {% if localizedUrls |length > 1 %} {% for key, value in localizedUrls %}