Merge pull request #16138 from CartoDB/feature/ch124440/indexing-do-catalog-in-google-dataset-search

Added JSON-LD in Data Catalog
pull/15939/head^2
Víctor Velarde 4 years ago committed by GitHub
commit cf0275c8f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,7 @@ sudo make install
- Add preview/visualization of maps in DO catalog [#15973](https://github.com/CartoDB/cartodb/pull/15973)
- Add new user metrics to Home page [#15950](https://github.com/CartoDB/cartodb/pull/15950)
- Replace CRUD user operations in Central API client by publishing messages to the Message Broker [#16035](https://github.com/CartoDB/cartodb/pull/16035)
- Adds JSON-LD with the dataset information in the Data Catalog [#16138](https://github.com/CartoDB/cartodb/pull/16138)
### Bug fixes / enhancements

@ -73,6 +73,8 @@
</transition>
</div>
</section>
<script v-if="publicWebsite" v-html="jsonld" type="application/ld+json"/>
</Page>
</template>
@ -107,6 +109,7 @@ export default {
computed: {
...mapState({
dataset: state => state.catalog.dataset,
keyVariables: state => state.catalog.keyVariables,
entity_type () {
return this.$route.params.entity_type;
}
@ -127,6 +130,37 @@ export default {
},
responsive () {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
},
jsonld () {
// The JSON-LD is used for SEO purposes and to index the site on Google Dataset Search
if (!this.dataset) {
return '';
}
const keyVariables = this.keyVariables && Array.isArray(this.keyVariables) ? this.keyVariables.map(elem => elem.name) : [];
const keywords = [...keyVariables];
keywords.push('Spatial data');
if (this.dataset.category_name) {
keywords.push(this.dataset.category_name);
}
if (this.dataset.data_source_name) {
keywords.push(this.dataset.data_source_name);
}
return {
'@context': 'https://schema.org/',
'@type': 'Dataset',
'name': this.dataset.name,
'description': this.dataset.description,
'keywords': keywords,
'license': this.dataset.licenses_link,
'creator': {
'@type': 'Organization',
'name': this.dataset.provider_name
},
'spatialCoverage': this.dataset.country_name,
'variableMeasured': keyVariables,
'version': this.dataset.version,
'url': `https://carto.com${this.$router.resolve({ name: 'catalog-dataset-summary', params: {...this.$route.params} }).href}`
};
}
},
methods: {

4
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "cartodb-ui",
"version": "1.0.0-assets.216",
"version": "1.0.0-assets.217",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -4718,7 +4718,7 @@
}
},
"vue-loader-v16": {
"version": "npm:vue-loader@16.1.2",
"version": "npm:vue-loader-v16@16.1.2",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz",
"integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==",
"dev": true,

@ -1,6 +1,6 @@
{
"name": "cartodb-ui",
"version": "1.0.0-assets.216",
"version": "1.0.0-assets.217",
"description": "CARTO UI frontend",
"repository": {
"type": "git",

Loading…
Cancel
Save