sawhney17 / logseq-schrodinger

A plugin to export pages in Logseq to Hugo.
MIT License
322 stars 38 forks source link

Does not respect `:publishing/all-pages-public? true` setting #29

Open flyinggrizzly opened 1 year ago

flyinggrizzly commented 1 year ago

I've been trying to get this set up, and every time I try to export the pages to Hugo nothing was happening.

I have the :publishing/all-pages-public? true setting configured in Logseq.

I tried setting one single page to public:: true, and then export, and finally got the destination dialog.

In my case, all pages in Logseq should be presumed public unless explicitly specified public:: false, since I'm using it as a topic-specific blogging tool, and I'd prefer not to have to remember to set all pages to public:: true, especially since I hierarchically nest pages in some cases, using the upper nodes of the hierarchy just as aggregation points. Eg:

In these cases, [[Mr Color]] and [[Mr Color/Surfacer]] don't need full pages of their own--they're useful primarily as catalogs of their child pages. I do this a lot (also for dates), so having to go through and edit each of these upper nodes would be tedious.

flyinggrizzly commented 1 year ago

As a follow up, I'm happy to open a PR and do the work make this change if someone can point me in the right direction in terms of querying graph settings with the JS client. Their API docs are a little sparse and I'm not flush with time.

sawhney17 commented 1 year ago

Unfortunately, I don't think this is exposed to the settings API. What I can do is add an option in plugin settings to make all pages public. On 5 Nov 2022 at 8:27 PM +0400, flyinggrizzly @.***>, wrote:

As a follow up, I'm happy to open a PR and do the work make this change if someone can point me in the right direction in terms of querying graph settings with the JS client. Their API docs are a little sparse and I'm not flush with time. β€” Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

flyinggrizzly commented 1 year ago

Yea, that would work too πŸ‘

Would you like me to take a stab at it, or would you prefer to handle it?

sawhney17 commented 1 year ago

really busy at the moment. If you can, a pr would be great! On 5 Nov 2022 at 9:45 PM +0400, flyinggrizzly @.***>, wrote:

Yea, that would work too πŸ‘ Would you like me to take a stab at it, or would you prefer to handle it? β€” Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

flyinggrizzly commented 1 year ago

Quick update: I'm trying to get the following behavior to work, and I'm stuck on the query:

I'm getting stuck on a query that will return all pages except those with public:: false set. I'm not a Clojure person, so this could just be a dumb thing (same for Datalog). What I have, and I think should work but it's not is:

#+BEGIN_QUERY
 {
    :title [:b "non-private pages"]
    :query [
      :find (pull ?page [*])
      :where
        [?page :block/name ?name]
        [?page :block/properties ?props]
        [(get ?props :public) ?publicness]
        [(not= false ?publicness)]
      ]
}
#+END_QUERY

Any thoughts? It would be easy to take the naive approach of "if the setting is on, allow no exceptions per-page", but that feels short-sighted...

I've also tried this

#+BEGIN_QUERY
 {
    :title [:b "non-private pages"]
    :query [
      :find (pull ?page [*])
      :where
        [?page :block/name ?name]
        [?page :block/properties ?props]
        [(get ?props :public) ?publicness]
        or([(= true ?publicness)] [(= nil ?publicness)])
      ]
}
#+END_QUERY
sawhney17 commented 1 year ago

This could

Try it using logseq.db.q("(not (page-property public true))")

Careful don’t test it in the database. It will freeze logseq. If you run through the console it is very fast

logseq.api.q("(not (page-property public true))") On 8 Nov 2022, 11:02 PM +0400, flyinggrizzly @.***>, wrote:

Quick update: I'm trying to get the following behavior to work, and I'm stuck on the query:

β€’ if settings.defaultPagesToPublic is ON, then all pages except those with public::false will be published β€’ if settings.defaultPagesToPublic is OFF, then only pages with public:: true will be published (current behavior)

I'm getting stuck on a query that will return all pages except those with public:: false set. I'm not a Clojure person, so this could just be a dumb thing (same for Datalog). What I have, and I think should work but it's not is:

+BEGIN_QUERY

{ :title [:b "non-private pages"] :query [ :find (pull ?page [*]) :where [?page :block/name ?name] [?page :block/properties ?props] [(get ?props :public) ?publicness] [(= nil ?publicness)] ] }

+END_QUERY

Any thoughts? It would be easy to take the naive approach of "if the setting is on, allow no exceptions per-page", but that feels short-sighted... β€” Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

bmann commented 1 year ago

@flyinggrizzly trying for the same thing and hit the same wall. @sawhney17 any plans for further work on this?