Is it that difficult for Simple Queries to implement a Title (property?) to replace the "Live Query" Badge?

I don’t care that I see that the current Query is a Live Query, I’d rather have a way to rename that or that a property of the Query block would replace that text with the value of the property. Even people who build Simple Queries would like to be able to give them names/titles…

{:title ["Title for simple Queries"] :query (and [[Title for Simple Queries]] <%Today%>) }}
{{query (and [[Title for Simple Queries]] <%Today%>) }}
query-title::  "Title for Simple Queries"

Anybody has any javascript/css way of doing this? I bet I am not alone in asking why such a common-sense feature has not landed in Simple Queries syntax …

  • Try adding this in file custom.js:
    const queries = document.getElementsByClassName("custom-query");
    const queriesObserver = new MutationObserver(function onMutated(){
        Array.prototype.forEach.call(queries, (div)=>{
            const blockId = div.closest(".ls-block").getAttribute("blockid");
            const properties = logseq.api.get_block(blockId).properties;
            const title = properties && properties.queryTitle;
            if (title) div.querySelector(".ml-1").textContent = title.slice(1, -1);
        })
    });
    queriesObserver.observe(document.getElementById("app-container"), {
        attributes: true,
        subtree: true,
        attributeFilter: ["class"]
    });
    
  • Then add property query-title:: as in your second example.
1 Like

That worked!! Thanks so much …

Can we increase the font for the Title Text ?

image

Try this in custom.css:

.ls-block .ml-1 {
  font-size: 16px;
}
1 Like

In case you want to hide the filter block and show it only when hovering with your mouse - there is a solution which works quiet well in combination with this live query title approach:
Hiding the Query Builder