@quartz-community/tag-page 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/components/index.js +21 -9
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +31 -17
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9c6c593: Bundles `@quartz-community/utils` 1.1.0: a short wikilink to an Obsidian folder note (`[[Topic]]` for `Topic/Topic.md`) reaches the folder page, and anchors to headings use the same slug as heading ids. `github-slugger` is no longer a dependency of this plugin.
|
|
8
|
+
|
|
9
|
+
## 1.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 6977c9a: On the tag index, a tag with child tags and a hand-written `tags/<tag>.md` page links to that page instead of the virtual `tags/<tag>/` page it replaces, which was never emitted (a broken link).
|
|
14
|
+
- d1bec5e: Tags that have child tags (e.g. `kubernetes` with `kubernetes/k3s`) are now emitted as `tags/<tag>/index.html` instead of `tags/<tag>.html`, so the parent tag page is reachable on static hosts that resolve the `tags/<tag>/` directory first (jackyzha0/quartz#2556). Leaf tag URLs are unchanged.
|
|
15
|
+
|
|
3
16
|
## 1.0.0
|
|
4
17
|
|
|
5
18
|
### Major Changes
|
package/dist/components/index.js
CHANGED
|
@@ -287,8 +287,6 @@ function byDateAndAlphabetical() {
|
|
|
287
287
|
return f1Title.localeCompare(f2Title);
|
|
288
288
|
};
|
|
289
289
|
}
|
|
290
|
-
|
|
291
|
-
// node_modules/@quartz-community/utils/dist/path.js
|
|
292
290
|
function simplifySlug(fp) {
|
|
293
291
|
const res = stripSlashes(trimSuffix(fp, "index"), true);
|
|
294
292
|
return res.length === 0 ? "/" : res;
|
|
@@ -2800,6 +2798,19 @@ function i18n(locale) {
|
|
|
2800
2798
|
return locales[locale] || en_US_default;
|
|
2801
2799
|
}
|
|
2802
2800
|
|
|
2801
|
+
// src/util/tags.ts
|
|
2802
|
+
function hasChildTags(tag, allTags) {
|
|
2803
|
+
const prefix = `${tag}/`;
|
|
2804
|
+
for (const t2 of allTags) {
|
|
2805
|
+
if (t2.startsWith(prefix)) return true;
|
|
2806
|
+
}
|
|
2807
|
+
return false;
|
|
2808
|
+
}
|
|
2809
|
+
function tagPageSlug(tag, allTags) {
|
|
2810
|
+
if (tag === "index") return "tags/index";
|
|
2811
|
+
return hasChildTags(tag, allTags) ? joinSegments("tags", tag, "index") : joinSegments("tags", tag);
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2803
2814
|
// src/components/styles/listPage.scss
|
|
2804
2815
|
var listPage_default = "ul.section-ul {\n list-style: none;\n margin-top: 2em;\n padding-left: 0;\n}\n\nli.section-li {\n margin-bottom: 1em;\n}\nli.section-li > .section {\n display: grid;\n grid-template-columns: fit-content(8em) 3fr 1fr;\n}\n@media all and (max-width: 600px) {\n li.section-li > .section > .tags {\n display: none;\n }\n}\nli.section-li > .section > .desc > h3 > a {\n background-color: transparent;\n}\nli.section-li > .section .meta {\n margin: 0 1em 0 0;\n opacity: 0.6;\n}\n\n.popover .section {\n grid-template-columns: fit-content(8em) 1fr !important;\n}\n.popover .section > .tags {\n display: none;\n}";
|
|
2805
2816
|
|
|
@@ -2819,12 +2830,13 @@ var TagContent_default = ((opts) => {
|
|
|
2819
2830
|
const TagContent = (props) => {
|
|
2820
2831
|
const { tree, fileData, allFiles, cfg } = props;
|
|
2821
2832
|
const fd = fileData;
|
|
2822
|
-
const
|
|
2833
|
+
const slug = fd.slug;
|
|
2823
2834
|
const locale = cfg?.locale ?? "en-US";
|
|
2824
|
-
if (!(
|
|
2825
|
-
throw new Error(`Component "TagContent" tried to render a non-tag page: ${
|
|
2835
|
+
if (!(slug?.startsWith("tags/") || slug === "tags")) {
|
|
2836
|
+
throw new Error(`Component "TagContent" tried to render a non-tag page: ${slug}`);
|
|
2826
2837
|
}
|
|
2827
|
-
|
|
2838
|
+
let tag = simplifySlug(slug.slice("tags/".length));
|
|
2839
|
+
if (tag !== "/" && tag.endsWith("/")) tag = tag.slice(0, -1);
|
|
2828
2840
|
const allPagesWithTag = (t2) => allFiles.filter(isListed).filter(
|
|
2829
2841
|
(file) => (file.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes).includes(t2)
|
|
2830
2842
|
);
|
|
@@ -2857,12 +2869,12 @@ var TagContent_default = ((opts) => {
|
|
|
2857
2869
|
sort: options?.sort
|
|
2858
2870
|
});
|
|
2859
2871
|
const contentPage = allFiles.find(
|
|
2860
|
-
(file) => file.slug === `tags/${t2}`
|
|
2872
|
+
(file) => file.slug === `tags/${t2}` || file.slug === `tags/${t2}/index`
|
|
2861
2873
|
);
|
|
2862
2874
|
const root2 = contentPage?.filePath ? contentPage?.htmlAst : void 0;
|
|
2863
2875
|
const tagDesc = !root2 || root2.children.length === 0 ? contentPage?.description : htmlToJsx(root2);
|
|
2864
|
-
const tagListingPage =
|
|
2865
|
-
const href = resolveRelative(
|
|
2876
|
+
const tagListingPage = contentPage?.slug ?? tagPageSlug(t2, tags);
|
|
2877
|
+
const href = resolveRelative(slug, tagListingPage);
|
|
2866
2878
|
return /* @__PURE__ */ u2("div", { children: [
|
|
2867
2879
|
/* @__PURE__ */ u2("h2", { children: /* @__PURE__ */ u2("a", { class: "internal tag-link", href, children: t2 }) }),
|
|
2868
2880
|
tagDesc && /* @__PURE__ */ u2("p", { children: tagDesc }),
|