on master help sign in
search: fix for root dirs
commit91d3a6fabf039e533646797fbdfa452431eff5af authorMatilde Park <matilde@tlon.io> dateTue 27 Jul 2021, 18:10 (5 years ago) parent6b14d8c
2 files changed+4−3
components/Search.js+2−1 lib/cache.js+2−2
components/Search.js+2−1
@@ -168,7 +168,8 @@ export default function Search(props) {
168168 <Link href={slug} as={slug}>
169169 <div>
170170 <p className="font-medium text-base">
171− {parent} / {title}
171+ {parent !== "Content" ? `${parent} /` : ""}{" "}
172+ {title}
172173 </p>
173174 <p className="text-base font-regular text-small text-gray">
174175 {content}
lib/cache.js+2−2
@@ -2,7 +2,6 @@ const fs = require("fs");
22const path = require("path");
33const matter = require("gray-matter");
44const toml = require("@iarna/toml");
5−const { data } = require("remark");
65
76const options = {
87 engines: {
@@ -40,7 +39,8 @@ function buildSearchIndex(dir) {
4039 title: pageData.title,
4140 base: page.name,
4241 slug: path.join(
43− dir.substr(dir.indexOf("content/") + 7),
42+ dir.substr(dir.indexOf("content") + 7),
43+ "/",
4444 page.name.replace(/.md$/, "")
4545 ),
4646 content: pageData.description || "",