add support for hreflang in links

This commit is contained in:
Tom Kralidis
2018-05-03 19:56:31 +00:00
parent 8780e9c544
commit 6d4a58b454
2 changed files with 13 additions and 2 deletions
+6
View File
@@ -62,10 +62,12 @@ datasets:
rel: canonical
title: data
href: https://github.com/mapserver/mapserver/blob/branch-7-0/msautotest/wxs/data/obs.csv
hreflang: en-US
- type: text/csv
rel: alternate
title: data
href: https://raw.githubusercontent.com/mapserver/mapserver/branch-7-0/msautotest/wxs/data/obs.csv
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
@@ -91,10 +93,12 @@ datasets:
rel: canonical
title: information
href: http://www.naturalearthdata.com/downloads/110m-cultural-vectors/110m-populated-places/
hreflang: en-US
- type: application/gzip
rel: canonical
title: download
href: http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_populated_places_simple.zip
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
@@ -115,6 +119,7 @@ datasets:
rel: canonical
title: information
href: http://www.naturalearthdata.com/
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
@@ -139,6 +144,7 @@ datasets:
rel: canonical
title: information
href: http://www.naturalearthdata.com/
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
+7 -2
View File
@@ -104,7 +104,8 @@ class API(object):
'rel': 'self',
'type': 'text/html',
'title': 'this document as HTML',
'href': '{}/?f=html'.format(self.config['server']['url'])
'href': '{}/?f=html'.format(self.config['server']['url']),
'hreflang': self.config['server']['language']
}, {
'rel': 'self',
'type': 'application/openapi+json;version=3.0',
@@ -114,7 +115,8 @@ class API(object):
'rel': 'self',
'type': 'text/html',
'title': 'the OpenAPI definition as HTML',
'href': '{}/api?f=html'.format(self.config['server']['url'])
'href': '{}/api?f=html'.format(self.config['server']['url']),
'hreflang': self.config['server']['language']
}
]
@@ -241,6 +243,9 @@ class API(object):
'title': link['title'],
'href': link['href']
}
if 'hreflang' in link:
lnk['hreflang'] = link['hreflang']
collection['links'].append(lnk)
if dataset is not None and k == dataset: