File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @holidayextras/static-site-generator" ,
3- "version" : " 8.0.9 " ,
3+ "version" : " 8.0.10 " ,
44 "description" : " Holiday Extras Static Site Generator in metalsmith / react" ,
55 "repository" : {
66 "type" : " git" ,
3030 "clone" : " ^1.0.2" ,
3131 "debug" : " ^2.2.0" ,
3232 "jsonp" : " ^0.2.0" ,
33+ "lodash" : " ^4.17.21" ,
3334 "meta-marked" : " ^0.4.0" ,
3435 "metalsmith" : " ^2.3.0" ,
3536 "metalsmith-assets" : " ^0.1.0" ,
Original file line number Diff line number Diff line change 11import prismic from './metalsmith-prismic'
22import hxseo from './getHXSEOContent'
33import apiCaller from './apiCaller'
4+ import _ from 'lodash'
45
56const getDataSource = ( opts ) => {
67 if ( ! opts . dataSource ) return false
@@ -15,6 +16,12 @@ const getDataSource = (opts) => {
1516 'accessToken' : opts . dataSource . accessToken ,
1617 'linkResolver' : configLinkResolver || function ( ctx , doc ) {
1718 if ( doc . isBroken ) return ''
19+ if ( _ . has ( doc , 'data.slug.json.value' ) ) {
20+ const regExpDomain = new RegExp ( `.*${ opts . config . domainSettings . domainLive } ` )
21+ // Strip domain (+ everything before it) off of the slug in case it was added by mistake
22+ const slug = doc . data . slug . json . value
23+ return slug . replace ( regExpDomain , '' )
24+ }
1825 return '/' + doc . uid
1926 }
2027 } )
You can’t perform that action at this time.
0 commit comments