Open tophee opened 1 year ago
Same issue as #60
@Trikzon suggested using dataview inline fields for adding metadata, but its not the same as using Obsidian's native support for aliases/tags.
{% persist "tags" %}
tags:: Incomplete
{% endpersist %}
Found this trick to work to rebuild frontmatter from Templater instead of this plugin: https://forum.obsidian.md/t/frontmatter-in-templater-seeking-solutions-for-3-use-cases/67670/5
Add this snippet in your file (this adapted snippet from my Vault has not been tested, let me know if it doesn't work for you):
<%*
// Source : https://forum.obsidian.md/t/frontmatter-in-templater-seeking-solutions-for-3-use-cases/67670/5
// The reason for the timeout is to wait until after the new note exists in your vault.
setTimeout(() => {
// Get the path to the new file
const newFile = tp.file.find_tfile(tp.file.path(true))
// Process the frontmatter
app.fileManager.processFrontMatter(newFile, (frontmatter) => {
// Add a new field
frontmatter['Related'] = '[[Source bibliographique]]' // Related notes property
frontmatter['citekey'] = '{{citekey}}' // Normal property
frontmatter['alias'] = ['{{title}}', '{{citekey}}'] // List property
})
}, 300)
%>
Is there a way of protecting YAML frontmatter when a literature note is overwritten upon re-import?
I tried
but it breaks the yaml-header (aliases no longer work for a note because of the
%% begin yaml %%
and%% end yaml %%
.(And even if those comments weren't a problem, it would still not work, because a new alias line would be added to the header and once there is more than one alias line, they all stop working. But that is a different issue.
For now I would just like to manually add aliases and prevent the template from overwriting them upon import. Is there a way?