Closed sywhb closed 7 months ago
When isSinglePage
is false, it's 100% an unnecessary clutter.
I'm far from being competent with TS and how Logseq works, so I'll not open a PR about it as I know I'll not be able to address deeper issues about it, but I think that should a good starting point:
(both changes are inside a if (!isSinglePage) {
check, noted because it's not clear from the diff)
❯ git diff src
diff --git a/src/index.ts b/src/index.ts
index 50c9737..2643725 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -239,7 +239,8 @@ const fetchOmnivore = async (inBackground = false) => {
pageName = replaceIllegalChars(
renderPageName(article, pageNameTemplate, preferredDateFormat)
)
- targetBlockId = (await getOmnivoreBlock(pageName, blockTitle)).uuid
+ const page = await getOmnivorePage(pageName)
+ targetBlockId = page.uuid
}
const articleBatch = articleBatchMap.get(targetBlockId) || []
// render article content
@@ -415,7 +416,8 @@ const fetchOmnivore = async (inBackground = false) => {
pageNameTemplate,
preferredDateFormat
)
- targetBlockId = (await getOmnivoreBlock(pageName, blockTitle)).uuid
+ const page = await getOmnivorePage(pageName)
+ targetBlockId = page.uuid
// delete page if article is synced to a separate page and page is not a journal
const existingPage = await logseq.Editor.getPage(pageName)
I'm sure I'm missing things that has to be updated to achieve this.
Hey @yitsushi, thanks for inspiration and I have made some changes based on your code.
A new version of the plugin v1.14.0
is just released and I have added a setting for people to customize the heading.
It'd be good as well if it could be optionally disabled all together. If you save each article on a separate page you don't need this top block on it.