diff --git a/lib/models/account-template.js b/lib/models/account-template.js index 03390683..d7a300cc 100644 --- a/lib/models/account-template.js +++ b/lib/models/account-template.js @@ -6,6 +6,7 @@ const recursiveRead = require('recursive-readdir') const fsUtils = require('../common/fs-utils') const templateUtils = require('../common/template-utils') const LDP = require('../ldp') +const { URL } = require('url') const TEMPLATE_EXTENSIONS = ['.acl', '.meta', '.json', '.hbs', '.handlebars'] const TEMPLATE_FILES = ['card'] @@ -72,9 +73,12 @@ class AccountTemplate { * @return {Object} */ static templateSubstitutionsFor (userAccount) { + const webUri = new URL(userAccount.webId) + const webIdOrigin = webUri.protocol + '//' + webUri.hostname + const podRelWebId = userAccount.webId.replace(webIdOrigin, '') const substitutions = { name: userAccount.displayName, - webId: userAccount.externalWebId ? userAccount.webId : '/profile/card#me', + webId: userAccount.externalWebId ? userAccount.webId : podRelWebId, email: userAccount.email, idp: userAccount.idp }