Skip to content

Commit

Permalink
Fix missing source path when reading collection files
Browse files Browse the repository at this point in the history
  • Loading branch information
rphillips-cc committed Dec 1, 2022
1 parent 496e336 commit 2a7536e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Creates [CloudCannon](https://cloudcannon.com/) build information for sites made

This tool runs after your Hugo build, reading your configuration to find pages, collections, and
data files to create a JSON file used to automatically integrate the site with CloudCannon. This
JSON file is written to `_cloudcannon/info.json`.
JSON file is written to `_cloudcannon/info.json` in your destination folder.

[<img src="https://img.shields.io/npm/v/cloudcannon-hugo?logo=npm" alt="version badge">](https://www.npmjs.com/package/cloudcannon-hugo)
[<img src="https://img.shields.io/npm/dt/cloudcannon-hugo" alt="downloads badge">](https://www.npmjs.com/package/cloudcannon-hugo)
Expand Down
4 changes: 2 additions & 2 deletions src/generators/collections.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { basename } from 'path';
import { basename, join } from 'path';
import chalk from 'chalk';
import { cheapPlural, runInChunks } from '../helpers/helpers.js';
import pathHelper from '../helpers/paths.js';
Expand Down Expand Up @@ -125,8 +125,8 @@ export function getPageUrlFromPath(path, contentDir) {
}

async function processItem(path, collectionKey, hugoUrls) {
const parsed = await parseFile(path);
const paths = pathHelper.getPaths();
const parsed = await parseFile(join(paths.source, path));

const item = {
url: hugoUrls[path] || getPageUrlFromPath(path, paths.content) || '',
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async function main({ flags, pkg }) {
pathHelper.generatePaths(hugoConfig);

const info = await getInfo(hugoConfig, pkg);
const infoData = JSON.stringify(info, null, 4);
const infoData = JSON.stringify(info, null, '\t');

const { source, publish } = pathHelper.getPaths();
const outputDir = join(source, publish, '_cloudcannon');
Expand Down

0 comments on commit 2a7536e

Please sign in to comment.