From 4592bde30d253b0469f86cce4ca5ecc98d1531e4 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Tue, 15 Mar 2022 00:37:56 -0700 Subject: [PATCH] feat: better titles for empty pages #61 --- assets/js/graph.js | 6 +++--- content/_index.md | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/js/graph.js b/assets/js/graph.js index c6c87185..6a630244 100644 --- a/assets/js/graph.js +++ b/assets/js/graph.js @@ -129,7 +129,7 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege .on("click", (_, d) => { window.location.href = baseUrl + '/' + decodeURI(d.id).replace(/\s+/g, '-') }) - .on("mouseover", function (_, d) { + .on("mouseover", function(_, d) { d3.selectAll(".node") .transition() .duration(100) @@ -159,7 +159,7 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege .transition() .duration(200) .style("opacity", 1) - }).on("mouseleave", function (_, d) { + }).on("mouseleave", function(_, d) { d3.selectAll(".node") .transition() .duration(200) @@ -185,7 +185,7 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege const labels = graphNode.append("text") .attr("dx", 12) .attr("dy", ".35em") - .text((d) => content[decodeURI(d.id).replace(/\s+/g, '-')]?.title || "Untitled") + .text((d) => content[decodeURI(d.id).replace(/\s+/g, '-')]?.title || d.id.replace("-", " ")) .style("opacity", 0) .style("pointer-events", "none") .call(drag(simulation)); diff --git a/content/_index.md b/content/_index.md index 1f920e03..4d5bcc31 100644 --- a/content/_index.md +++ b/content/_index.md @@ -24,3 +24,4 @@ If you prefer browsing the contents of this site through a list instead of a gra - 🚧 [Troubleshooting and FAQ](notes/troubleshooting.md) - 🐛 [Submit an Issue](https://github.com/jackyzha0/quartz/issues) - 👀 [Discord Community](https://discord.gg/cRFFHYye7t) +