Create a [[@FirstName LastName]] link page

It would be nice to have a Logseq natively support [[@FirstName LastName]] for identifying people. This is useful for assigning tasks to people. When a person is added, it needs to have attributes like First Name, Last Name, Birth Day, email as default attributes and allow custom attributes from the user. This can lead to an address book feature in logseq.

+1 Love this idea, but don’t have any votes left :confused:

1 Like

I can imagine a way of incorporating this concept in a way that is more universal/generic and that could be applied to other frequent categories.

However your example of contacts is so useful I think even if this were enabled in a more expandable way, the default config for Logseq should enable contacts to be on by default.

This would mean that Logseq could handle contacts much better out of the box, and it would feel native, but instead of being hard coded, it would be a function enabled via the config so that a user could add even more backlink handlers if they wanted.

If in the config file, maybe a definition such as:

;; Backlink [[ x ]] symbol handler
;;
;; This allows for a few custom cases where you can assign a way to handle
;; certain backlinks differently, enabling you to build quicker connections in
;; your notes depending on what subject domains are important to you.
;;
;; By default Logseq has the symbol handler for contacts already setup, see
;; the definition below.
:backlink-handler [
  {
    :name "Contact"
    :escape-characters "@"
    :namespace ""
    :default-properties [
      ("Type" "Contact")
     ]
    :args {
      :required ["FirstName" "LastName"]
      :optional ["Phone" "Email" "Relationship" "DoB" "Fax" "Address"]
    }
    ;; :template "Templates/Contacts" ; optional!
    ; If you do use a template, things like default properties can be set there
    ; instead of defined in these blocks.
  }
]

From the users perspective, this is what happens as they type [[@FirstName LastName]]:

  1. [[ Logseq does its backlink list thing like normal
  2. @ Now Logseq will show a small dialog that says
    **FirstName** **LastName** DoB Email Phone Fax Address
    The required inputs are in bold, the optional in a much lighter text, so the user knows the order.
  3. ]] And finishes up like normal.

Once the user clicks that link, Logseq will build the page based on either just the definition above or a template if the user instead wants to bind a template to the action.
The optional values will become properties, just empty ones. (Does Logseq allow empty properties? It should if it doesn’t!)

To most Logseq users, the operation still looks like a native operation, by typing @ immediately after the backlink brackets, they can see that Logseq is asking for specific information, as it’s not just an ordinary backlink, it’s a special case for contacts.

However, I feel if the functionality is enabled in a way like I suggest, any user could add to their own Logseq graph quite easily, for example if this were defined in your config:

:backlink-handler [
  {
    :name "Contact"
    :escape-characters "@"
    :namespace ""
    :default-properties [
      ("Type" "Contact")
     ]
    :args {
      :required ["FirstName" "LastName"]
      :optional ["Phone" "Email" "Relationship" "DoB" "Fax" "Address"]
    }
  },
  {
    :name "Book"
    :escape-characters "+b"
    :namespace "Books"
    :default-properties [
      ("Type" "Book")
     ]
    :args {
      :required ["BookName"]
      ; If you use a template you do not need to list all the optional properties
      ; here, just list the ones you want for quick input via the backlink
      ; mechanism.
      :optional ["Author" "YearPublished"]
    }
  },
  {
    :name "Movie"
    :escape-characters "+m"
    :namespace "Movies"
    :default-properties [
      ("Type" "Movie")
     ]
    :args {
      :required ["MovieName"]
      :optional ["Year"]
    }
  }
  ,
  {
    :name "Person"
    :escape-characters "@@"
    :namespace ""
    :default-properties [
      ("Type" "Person")
     ]
    :args {
      :required ["FirstName" "LastName"]
      :optional ["Born" "Died" "Gender"]
    }
  },
  {
    :name "Character"
    :escape-characters "@@@"
    :namespace "Fiction/Character"
    :default-properties [
      ("Type" "Character")
     ]
    :args {
      :required ["FirstName" "LastName"]
      :optional ["Appears in" "Gender"]
    }
  }
]

Then the following additional functionality would be added for that user:

  • [[@...]] For contacts (people we have been in contact with during our lives)
  • [[@@...]] For people in general, useful perhaps for an historian who uses Logseq for both handling their contacts and also keeping track of people.
  • [[@@@...]] This would be useful for an author keeping track of their characters and still being able to use the single @ for contacts only.
  • [[+b...]] Quickly add a book
  • [[+m...]] Quickly add a movie

If the user wants contacts, they would type [[@ and then press enter/return.

For contacts:

  1. [
  2. [
  3. @
  4. Press enter/return
  5. Types the first name
  6. Press enter/return
  7. Types the last name
  8. Press enter/return
  9. Either enters text for an optional value OR presses enter/return a second time thus completing the backlink.

And for a book:

  1. [
  2. [
  3. +
  4. m
  5. Press enter/return
  6. Types the book name
  7. Press enter/return
  8. Either enters text for an optional value OR presses enter/return a second time thus completing the backlink.
4 Likes

This sounds amazing and exactly what I’m hoping for – does it work? Or is it theoretical? The way you worded this post, it sounds like it doesn’t yet work how you would hope?

I’ll give it a try now on the off chance… but fingers crossed, and devs, please consider this when you’re done building the (understandable) revenue-generating sync features and whatever else!!