Desktop app with externally created file

I am using logseq desktop alongside with other markdown tools. I created a markdown file with another tool and now logseq doesn’t find it. When I try to create a page named that, it complains, that the page already exists. How can I tell logseq to look for new .md files?

Have you tried re-index your graph? Does the markdown file has a “title” attribute in the front matter?

No, it does not have a title. Adding a title does help.

But could I get it indexed without the need to add a title?

Currently, the page name order is title attribute > first heading’s title > file name.

There’s a :page-name-order option, if you prefer to use the file name as the page title instead of the first heading’s title, add :page-name-order "file " to the file logseq/config.edn , and then re-index your graph.

3 Likes

Hey thanks for the great tip, is there a particular place in the logseq/config.edn file to put this in, or it doesn’t matter?

also is there supposed to be a space after "file " like that?

:page-name-order "file "

Thanks this would be extremely useful

1 Like

hi Santi:

as I couldn’t find an existing option in https://logseq.com/#/file/logseq%2Fconfig.edn I just added …



:inputs [:today :7d-after]
:collapsed? false}]}

;; MINE
:page-name-order “file”

;; Add your own commands to speedup.
;; E.g. [[“js” “Javascript”]]
:commands

at line# 68/69 and it worked.
I´m also lookig forward to @tienson response as I’m a total newbie and was just happy to find this option as it helps me with importing my Google Keep’s notes using Barycenter’s excellent Google Keep notes to Obsidian markdown Python Converter in Logseq

1 Like

thanks a lot for the tip, I’ll be trying it out, I appreciate your help!

@tienson : could you elaborate a bit please, I’m slightly confused with this setting :

Currently, the page name order is title attribute > first heading’s title > file name.

  • initially I thought that when the title attribute is missing, the title would fallback to first heading's title <h1> then if <h1> is also missing it will fallback on filename by default ? (so pages with a TITLE: will be named with title.ext, and pages without ftonmatter would be named %h1%.txt or %filename%.ext)
  • if it’s how it should work, it seems the fallback mecanism sometimes fails since the file already exist msg pops when a page doesn’t have a frontmatter even if the %h1% or %filename% is unique ?

There’s a :page-name-order option, if you prefer to use the file name as the page title instead of the first heading’s title, add :page-name-order "file " to the file logseq/config.edn , and then re-index your graph.

  • my config.edn is set to :page-name-order "file"
    • when I link to a new page [[newfile]], Logseq creates a file pages/newfile.org which has a #+TITLE: newfile
    • now if I edit the page to #+TITLE: newfile RENAMED, the FILE is also renamed newfile RENAMED.org. I would have expected the title to be bypassed according to the config :page-name-order "file" but apparently, the TITLE property still superseeds everything ? (same thing when using the rename menu)
    • another case :
      • I create a new file externally in notepad :notepad.md in my local graph without any TITLE property, nor any front matter, then reindex.
      • The file appears in logseq and I can read it, at this stage, title=filename (notepad => /pages/notepad.md).
      • Now if I rename the page in logseq to NEWNAME using the rename menu : logseq adds a TITLE property and renames the file to NEWNAME.org
      • in explorer, I rename NEWNAME.org to test.org and reindex. in logseq, since the page has a title, my file test.org still has the title NEWNAME (even though the config setting is :page-name-order 'file" since the beginning)

Probably I am misinterpreting what the :page-name-order setting actually does ? I thought it was a bypass to overule the TITLE property to always use the filename, but from what I see :

  • in logseq changing a page TITLE will auto rename the corresponding file to %title%.ext (disregarding the config :page-name-order property)
  • when the page has no front matter or no TITLE property, renaming the FILE externally will also rename the page title, without generating a title property/front matter.
  • when the page has no front matter or no TITLE property, renaming the PAGE in Logseq will also rename the filename, and attempts to generate a title property/front matter (btw see related GH issue: #1510)

TLDR

Maybe when the front matter is missing (or the TITLE property is missing), it would be better if logseq could generate a front matter where TITLE: %filename% ? (based on a setting in config, autocreate title : no / yes from filename / yes from h1 - default : use title property)
or warn the user on a per-file base when the TITLE property is missing ? ( this would not be efficient if there are a lot of files, eg: import from obsidian)

2 Likes

Thanks, it really solved the issue, but seem that the option is either broken or has a misleading name. If those are just priorities, then modifing the priority shouldn’t exclude some notes from indexing. If that option is intended to filter out notes not having a title, it should have an other name. :thinking:

What do you think?

Personally I’d love it if logseq didn’t have to create the title metadata, but if instead by default the file name could determine the note’s title

In general removing the need for:

---
title:
---

conflict with other tools

For instance I use gatsby to create my website from .md files.

In gatsby the file name is the name of the URL

example:

Let’s say I’m writing a blogpost on “My Note-taking Journey”

I’d like to call my file name:

notes-journey.md

In my case this would allow gatsby to create the URL for the blogpost in the following way:

https://santiyounger.com/how-to-take-notes

Now gatsby needs me to dermine the title of the blogpost using title in metadata

Example:

---
title: My Note-taking journey
---

This is easy to achieve with regular .md files. However since logseq uses the title: attribute to determine the note’s title. I have a conflict that I have to workaround in annoying ways.


TLDR - Too Long Didn’t Read

I think it’d be better if Logseq could use file names for notes’s title. And remove the title: attribute in metadata to avoid conflicts with other tools.

Thanks!

2 Likes