-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom content/posts folder setting #19
Comments
I see that this part of the code is responsible for it (src/extension.ts): const newPost = () => {
vscode.window.showInputBox({ placeHolder: 'Enter filename' }).then((filename) => {
const newPostPath = path.join(vscode.workspace.rootPath, 'content', 'post', filename);
const postPath = 'post' + path.sep + filename;
const newPostCmd = spawn('hugo', ['new', postPath, `-s="${vscode.workspace.rootPath}"`], { shell: true });
newPostCmd.stdout.on('data', (data) => {
vscode.window.showInformationMessage(data);
});
newPostCmd.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
vscode.window.showInformationMessage(`Error creating new post.`);
});
newPostCmd.on('close', (code) => {
if (code === 0) {
let uripath = vscode.Uri.file(newPostPath);
vscode.workspace.openTextDocument(uripath).then((document) => {
vscode.window.showTextDocument(document);
}, err => {
console.log(err);
});
} else {
vscode.window.showErrorMessage(`Error creating new post.`);
}
});
});
}; The "post" word would need to be made a variable which can be set in the extension configuration. At the moment, the extension is not configurable. Unfortunately, I have never done TypeScript or VScode extensions. If you know how to, or know someone who knows how to, please create a PR. |
Try this Extension: https://marketplace.visualstudio.com/items?itemName=phoenisx.gohugo |
How can I set a custom content/posts folder like /src/site/content ?
The text was updated successfully, but these errors were encountered: