Merge pull request #56 from StampyAI/duckduckgo

link to duckduckgo when url field empty
This commit is contained in:
FraserLee
2023-07-10 20:42:00 -04:00
committed by GitHub
+6 -1
View File
@@ -72,9 +72,14 @@ const ShowCitation: React.FC<{citation: Citation, i: number}> = ({citation, i})
if (citation.date && citation.date !== "")
c_str += " - " + citation.date;
// if we don't have a url, link to a duckduckgo search for the title instead
const url = citation.url && citation.url !== ""
? citation.url
: `https://duckduckgo.com/?q=${encodeURIComponent(citation.title)}`;
return (
<A className={Colours[i % Colours.length] + " border-2 flex items-center rounded my-2 text-sm no-underline w-fit"}
href={citation.url}>
href={url}>
<span className="mx-1"> [{i + 1}] </span>
<p className="mx-1 my-0"> {c_str} </p>
</A>