Skip to content

Commit

Permalink
moved JSON-LD markup to plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Jul 15, 2024
1 parent 0ca8f70 commit 430d3db
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 77 deletions.
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ server {
}

location ~ (?<no_slash>.*)/$ {
return 301 $scheme://$host$no_slash;
return 301 $scheme://$host$no_slash;
}
}
1 change: 1 addition & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default {

// Plugins to run before rendering page (https://go.nuxtjs.dev/config-plugins)
plugins: [
'~/plugins/jsonld'
],

// Auto import components (https://go.nuxtjs.dev/config-components)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"dependencies": {
"core-js": "^3.16.1",
"nuxt": "^2.15.8"
"nuxt": "^2.15.8",
"nuxt-jsonld": "v1"
},
"devDependencies": {
"@nuxt/types": "^2.15.8",
Expand All @@ -30,7 +31,6 @@
"postcss-custom-media": "^7.0.8",
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.2.3",
"postcss-nested-ancestors": "^2.0.0",
"vue-meta": "^2.4.0"
"postcss-nested-ancestors": "^2.0.0"
}
}
136 changes: 63 additions & 73 deletions pages/ru.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import UsedByTable, {UsedByItem} from '~/components/used-by-table.vue';
import UiButton from '~/components/ui-button.vue';
import Contact from '~/components/contact.vue';
import gridInfo from '~/components/grid-info.vue';
import { MetaInfo } from 'vue-meta';
export default Vue.extend({
components: {
Expand All @@ -87,6 +86,68 @@ export default Vue.extend({
gridInfo,
},
layout: 'ru',
jsonld() {
return [{
"@context": "https://schema.org",
"@type": "WebPage",
"name": "Хоук — российский трекер ошибок",
"description": "Мониторинг ошибок в ПО с серверами в России и открытым исходным кодом",
"image": "https://hawk.so/hawk-ru-og-image.png",
"url": "https://hawk.so/ru",
"publisher": {
"@type": "Organization",
"name": "Хоук",
"logo": {
"@type": "ImageObject",
"url": "https://hawk.so/hawk-ru-og-image.png"
}
},
"creator": {
"@type": "Organization",
"name": "CodeX",
"description": "Команда open-source разработчиков",
"url": "https://codex.so",
"logo": {
"@type": "ImageObject",
"url": "https://codex.so/public/app/img/codex-logo.svg"
},
"sameAs": [
"http://twitter.com/codex_team"
]
}
},
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Хоук — российский трекер ошибок",
"description": "Мониторинг ошибок в ПО с серверами в России и открытым исходным кодом",
"image": "https://hawk.so/hawk-ru-og-image.png",
"brand": {
"@type": "Brand",
"name": "Хоук"
},
"offers": {
"@type": "Offer",
"url": "https://hawk.so/ru",
"priceCurrency": "RUB",
"price": "0", // Adjust this value to the actual price
"availability": "https://schema.org/InStock"
},
"creator": {
"@type": "Organization",
"name": "CodeX",
"description": "Команда open-source разработчиков",
"url": "https://codex.so",
"logo": {
"@type": "ImageObject",
"url": "https://codex.so/public/app/img/codex-logo.svg"
},
"sameAs": [
"http://twitter.com/codex_team"
]
}
}]
},
data(): {
/**
* Features list description
Expand Down Expand Up @@ -316,7 +377,7 @@ export default Vue.extend({
}
},
},
head(): MetaInfo {
head() {
return {
title: "Хоук — российский трекер ошибок",
meta: [
Expand Down Expand Up @@ -376,77 +437,6 @@ export default Vue.extend({
content: 'https://hawk.so/ru'
},
],
script: [
{
// JSON-LD schema.org markup for WebPage
type: 'application/ld+json',
json: {
"@context": "https://schema.org",
"@type": "WebPage",
"name": "Хоук — российский трекер ошибок",
"description": "Мониторинг ошибок в ПО с серверами в России и открытым исходным кодом",
"image": "https://hawk.so/hawk-ru-og-image.png",
"url": "https://hawk.so/ru",
"publisher": {
"@type": "Organization",
"name": "Хоук",
"logo": {
"@type": "ImageObject",
"url": "https://hawk.so/hawk-ru-og-image.png"
}
},
"creator": {
"@type": "Organization",
"name": "CodeX",
"description": "Команда open-source разработчиков",
"url": "https://codex.so",
"logo": {
"@type": "ImageObject",
"url": "https://codex.so/public/app/img/codex-logo.svg"
},
"sameAs": [
"http://twitter.com/codex_team"
]
}
}
},
{
// JSON-LD schema.org markup for Product
type: 'application/ld+json',
json: {
"@context": "https://schema.org",
"@type": "Product",
"name": "Хоук — российский трекер ошибок",
"description": "Мониторинг ошибок в ПО с серверами в России и открытым исходным кодом",
"image": "https://hawk.so/hawk-ru-og-image.png",
"brand": {
"@type": "Brand",
"name": "Хоук"
},
"offers": {
"@type": "Offer",
"url": "https://hawk.so/ru",
"priceCurrency": "RUB",
"price": "0", // Adjust this value to the actual price
"availability": "https://schema.org/InStock"
},
"creator": {
"@type": "Organization",
"name": "CodeX",
"description": "Команда open-source разработчиков",
"url": "https://codex.so",
"logo": {
"@type": "ImageObject",
"url": "https://codex.so/public/app/img/codex-logo.svg"
},
"sameAs": [
"http://twitter.com/codex_team"
]
}
}
}
],
__dangerouslyDisableSanitizers: ['script'],
}
}
});
Expand Down
4 changes: 4 additions & 0 deletions plugins/jsonld.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue';
import NuxtJsonld from 'nuxt-jsonld';

Vue.use(NuxtJsonld);
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5457,6 +5457,13 @@ num2fraction@^1.2.2:
version "1.2.2"
resolved "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz"

nuxt-jsonld@v1:
version "1.5.8"
resolved "https://registry.yarnpkg.com/nuxt-jsonld/-/nuxt-jsonld-1.5.8.tgz#bc14a9261d7fba4df779f7f29f80214c43ebfb23"
integrity sha512-D+xYmegfxNtDH39W6Aa8B7swAfYvIF807BsDe5KtQNLk83YpYm+dqASSDVeVN6sZsrBNy5Qr/VqzB+z0M2InYQ==
dependencies:
schema-dts "^1.0.0"

nuxt@^2.15.8:
version "2.15.8"
resolved "https://registry.npmjs.org/nuxt/-/nuxt-2.15.8.tgz"
Expand Down Expand Up @@ -6923,6 +6930,11 @@ sax@~1.2.4:
version "1.2.4"
resolved "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz"

schema-dts@^1.0.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/schema-dts/-/schema-dts-1.1.2.tgz#82ccf71b5dcb80065a1cc5941888507a4ce1e44b"
integrity sha512-MpNwH0dZJHinVxk9bT8XUdjKTxMYrA5bLtrrGmFA6PTLwlOKnhi67XoRd6/ty+Djt6ZC0slR57qFhZDNMI6DhQ==

[email protected]:
version "2.7.0"
resolved "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.0.tgz"
Expand Down

0 comments on commit 430d3db

Please sign in to comment.