fix(v2): do not reveal environment file path (#1692)

* fix(v2): do not reveal environment file path

* changelog

* fix broken markdown linking
This commit is contained in:
Yangshun Tay 2019-07-22 23:12:21 -07:00 committed by Endi
parent 84b2270039
commit a684806a0f
9 changed files with 48 additions and 41 deletions

View file

@ -49,7 +49,7 @@ module.exports = function(context, opts) {
// Fetches blog contents and returns metadata for the necessary routes.
async loadContent() {
const {postsPerPage, include, routeBasePath} = options;
const {siteConfig} = context;
const {siteConfig, siteDir} = context;
const blogDir = contentPath;
if (!fs.existsSync(blogDir)) {
@ -65,8 +65,9 @@ module.exports = function(context, opts) {
await Promise.all(
blogFiles.map(async relativeSource => {
// Cannot use path.join() as it resolves '../' and removes the '@site'. Let webpack loader resolve it.
const source = path.join(blogDir, relativeSource);
const aliasedSource = `@site/${path.relative(siteDir, source)}`;
const blogFileName = path.basename(relativeSource);
// Extract, YYYY, MM, DD from the file name.
const filePathDateArr = blogFileName.split('-');
@ -87,7 +88,7 @@ module.exports = function(context, opts) {
routeBasePath,
frontMatter.id || fileToUrl(blogFileName),
]),
source,
source: aliasedSource,
description: frontMatter.description || excerpt,
date,
tags: frontMatter.tags,