From b2f3642fc6a96b3d73ccc06a9b6a0d6c04b3cd02 Mon Sep 17 00:00:00 2001 From: Marvin Chin Date: Fri, 22 Feb 2019 04:24:31 +0800 Subject: [PATCH] fix: use clean url for og:url when cleanUrl is true (#1242) --- v1/lib/core/Site.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/v1/lib/core/Site.js b/v1/lib/core/Site.js index 671775ce21..e23ac5b08b 100644 --- a/v1/lib/core/Site.js +++ b/v1/lib/core/Site.js @@ -16,7 +16,7 @@ const Footer = require(`${process.cwd()}/core/Footer.js`); const translation = require('../server/translation.js'); const env = require('../server/env.js'); const liveReloadServer = require('../server/liveReloadServer.js'); -const {idx} = require('./utils.js'); +const {idx, getPath} = require('./utils.js'); const CWD = process.cwd(); @@ -41,10 +41,11 @@ class Site extends React.Component { `${this.props.config.title} ยท ${tagline}`) || this.props.config.title; const description = this.props.description || tagline; - const url = - this.props.config.url + - this.props.config.baseUrl + - (this.props.url || 'index.html'); + const path = getPath( + this.props.config.baseUrl + (this.props.url || 'index.html'), + this.props.config.cleanUrl, + ); + const url = this.props.config.url + path; let docsVersion = this.props.version; const liveReloadScriptUrl = liveReloadServer.getReloadScriptUrl();