Thank you @ariehen ,
Yes, of course, you are right - I should have thought of it
Sorry!
So, here is the template file for the project file, which generates both files (please be aware, I am by no means a programmer, and I am certain this can be done much nice and shorter
)
// define variable for input prompt "project description"
let var_project_description = await tp.system.prompt("project description in one sentence")
let var_type_project = await tp.system.suggester(["work", "Privat", "B@S"], ["work", "Privat", "B@S"])
let var_project_status = await tp.system.suggester(["planned", "next", "in process", "comnpleted", "cancelled", "on-hold", "archived"], ["planned", "next", "in process", "comnpleted", "cancelled", "on-hold", "archived"])
let var_reviewcadence = await tp.system.suggester(["daily", "weekly", "bi-weekly", "monthly", "bi-monthly", "quarerly", "six-months", "yearly"], ["daily", "weekly", "bi-weekly", "monthly", "bi-monthly", "quarerly", "six-months", "yearly"])
let var_priority = await tp.system.suggester(["top-priority ", "high ", "medium ", "well, yeah ", "get it done, sometime "], ["top-priority ", "high ", "medium ", "well, yeah ", "get it done, sometime "])
// define variable for file name of project template and file name of Kanban Board
var_titleName = "proj - " + tp.file.title
var_kanbanName = "KB - " + tp.file.title
var_tag = "#project-" + var_type_project + "/" + var_titleName.substring(7)
// rename project file based on variable of prior step
await tp.file.rename(var_titleName)
//define variable for new project directory
if (var_type_project == "Privat") {
var_dir = "2 privat/1 projekte/" + tp.file.title + "/" ;
}
else if (var_type_project == "B@S") {
var_dir = "1 work/1 projects/" + tp.file.title + "/" ;
}
else {
var_dir = "1 work/1 projects/" + tp.file.title + "/" ;
}
// if directory does not exist create directory
if (!tp.file.exists(var_dir)) {
await this.app.vault.createFolder("var_dir")
}
// move project file to project directory
await tp.file.move(var_dir + var_titleName)
// create file of kanban board based on template, name it based on variable and move it to project directory
await tp.file.create_new(tp.file.find_tfile("tmpl kanban"),var_kanbanName,false)
await tp.file.move(var_dir + var_kanbanName)
-%>
This is then followed by the frontmatter for the project file:
---
project_name: <% var_titleName %>
alias: <% tp.file.title %>
tags: <% var_tag %>
status: <% var_project_status %>
prio: <% var_priority %>
org: <% var_type_project %>
review_cadence: <% var_reviewcadence %>
reviewed:
project_start: <% tp.date.now("YY-MM-DD") %>
project_filename: <% var_titleName %>
project_kanbanboard: <% var_kanbanName %>
cssClass: minimal_float, wide-page
---
The Kanban file, generated by above looks as follows in the template version
<%*
var_folder = tp.file.folder(true)
var_title = tp.file.title.substring(5)
if (var_folder.includes("work")) {
var_tags = "#project-work/" + var_title;
}
else {
var_tags = "#project-privat/" + var_title;
}
-%>
---
kanban-plugin: basic
title: <% tp.file.title %>
tags: <% var_tags %>
Total:
Incomplete:
Completed:
---
## backlog
## todo next
## doing
## done
## archived
%% kanban:settings
{"kanban-plugin":"basic"}
%%
In the note version, when the Kanban file is generated (projectname: Test) it looks in markdown as follows - this contains the correct tag #project-work/Test:
---
kanban-plugin: basic
title: KB - Test
tags: #project-work/Test
Total:
Incomplete:
Completed:
---
## backlog
## todo next
## doing
## done
## archived
%% kanban:settings
{"kanban-plugin":"basic"}
%%
However, after I have entered some tasks ion the board, the tag is set to null
---
kanban-plugin: basic
title: KB - Test
tags: null
Total: 6
Incomplete: 6
Completed: 0
---
## backlog
- [ ] 1
- [ ] 2
- [ ] 3
- [ ] 4
- [ ] 5
- [ ] 6
No idea why …