diff --git a/src/modules/globals.ts b/src/modules/globals.ts
index e2f5aa3..c9e0fb2 100644
--- a/src/modules/globals.ts
+++ b/src/modules/globals.ts
@@ -8,6 +8,7 @@ type globalContextType = {
export interface propsObject {
icon?: string;
color?: string;
+ hidetitle?: boolean;
needStroke?: boolean;
}
diff --git a/src/modules/pageIcons/pageIcons.css b/src/modules/pageIcons/pageIcons.css
index 805b757..c658964 100644
--- a/src/modules/pageIcons/pageIcons.css
+++ b/src/modules/pageIcons/pageIcons.css
@@ -10,6 +10,12 @@
line-height: 1em;
width: 1.2em;
}
+.awLi-hideTitle.awLi-hasIcon {
+ font-size: 0;
+}
+.awLi-hideTitle .awLi-icon {
+ font-size: initial;
+}
.title .awLi-icon {
display: inline-block;
width: 1.4em;
diff --git a/src/modules/pageIcons/pageIcons.ts b/src/modules/pageIcons/pageIcons.ts
index d20ec16..c3c65cd 100644
--- a/src/modules/pageIcons/pageIcons.ts
+++ b/src/modules/pageIcons/pageIcons.ts
@@ -146,6 +146,14 @@ const setIconToLinkItem = async (linkItem: HTMLElement, pageProps: propsObject,
} else {
linkItem.insertAdjacentHTML('afterbegin', `${pageIcon}`);
}
+ linkItem.classList.add('awLi-hasIcon');
+ if (pageProps['hidetitle'] && linkItem.classList.contains('page-ref') || linkItem.classList.contains('tag')) {
+ linkItem.classList.add('awLi-hideTitle');
+ } else {
+ linkItem.classList.remove('awLi-hideTitle');
+ }
+ } else {
+ linkItem.classList.remove('awLi-hasIcon');
}
}
diff --git a/src/modules/pageIcons/queries.ts b/src/modules/pageIcons/queries.ts
index d4c96d4..2e88d4a 100644
--- a/src/modules/pageIcons/queries.ts
+++ b/src/modules/pageIcons/queries.ts
@@ -11,7 +11,7 @@ export const getLinkedPagesNumber = async (title: string): Promise => {
:where
[?b :block/page ?page]
[?b :block/refs ?ref-page]
- [?ref-page :block/name "logseq"]
+ [?ref-page :block/name "${title}"]
]
`;
const linkedPages = await logseq.DB.datascriptQuery(linkedQuery);
@@ -58,6 +58,9 @@ export const getPageProps = async (title: string): Promise => {
if (queryResultArr[0] && queryResultArr[0][0] && queryResultArr[0][0].color) {
pageProps.color = queryResultArr[0][0].color.replaceAll('"', '');
}
+ if (queryResultArr[0] && queryResultArr[0][0] && queryResultArr[0][0].hidetitle) {
+ pageProps.hidetitle = queryResultArr[0][0].hidetitle;
+ }
}
return pageProps;
}