Compare commits
7 Commits
1005-note-
...
core-story
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
049ad55362 | ||
|
|
5b03c43478 | ||
|
|
75fa429261 | ||
|
|
09f0c18b66 | ||
|
|
16e9fe4d60 | ||
|
|
f8851f12d9 | ||
|
|
aca5b88bdb |
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'@portaljs/remark-wiki-link': minor
|
||||
---
|
||||
|
||||
Parse note embeds as regular wiki links (until we add proper support for note embeds).
|
||||
@@ -15,9 +15,9 @@ const defaultWikiLinkResolver = (target: string) => {
|
||||
|
||||
export interface FromMarkdownOptions {
|
||||
pathFormat?:
|
||||
| "raw" // default; use for regular relative or absolute paths
|
||||
| "obsidian-absolute" // use for Obsidian-style absolute paths (with no leading slash)
|
||||
| "obsidian-short"; // use for Obsidian-style shortened paths (shortest path possible)
|
||||
| "raw" // default; use for regular relative or absolute paths
|
||||
| "obsidian-absolute" // use for Obsidian-style absolute paths (with no leading slash)
|
||||
| "obsidian-short"; // use for Obsidian-style shortened paths (shortest path possible)
|
||||
permalinks?: string[]; // list of permalinks to match possible permalinks of a wiki link against
|
||||
wikiLinkResolver?: (name: string) => string[]; // function to resolve wiki links to an array of possible permalinks
|
||||
newClassName?: string; // class name to add to links that don't have a matching permalink
|
||||
@@ -125,24 +125,13 @@ function fromMarkdown(opts: FromMarkdownOptions = {}) {
|
||||
if (isEmbed) {
|
||||
const [isSupportedFormat, format] = isSupportedFileFormat(target);
|
||||
if (!isSupportedFormat) {
|
||||
// Temporarily render note transclusion as a regular wiki link
|
||||
if (!format) {
|
||||
wikiLink.data.hName = "a";
|
||||
wikiLink.data.hProperties = {
|
||||
className: classNames + " " + "transclusion",
|
||||
href: hrefTemplate(link) + headingId,
|
||||
};
|
||||
wikiLink.data.hChildren = [{ type: "text", value: displayName }];
|
||||
|
||||
} else {
|
||||
wikiLink.data.hName = "p";
|
||||
wikiLink.data.hChildren = [
|
||||
{
|
||||
type: "text",
|
||||
value: `![[${target}]]`,
|
||||
},
|
||||
];
|
||||
}
|
||||
wikiLink.data.hName = "p";
|
||||
wikiLink.data.hChildren = [
|
||||
{
|
||||
type: "text",
|
||||
value: `![[${target}]]`,
|
||||
},
|
||||
];
|
||||
} else if (format === "pdf") {
|
||||
wikiLink.data.hName = "iframe";
|
||||
wikiLink.data.hProperties = {
|
||||
|
||||
@@ -15,9 +15,9 @@ const defaultWikiLinkResolver = (target: string) => {
|
||||
|
||||
export interface HtmlOptions {
|
||||
pathFormat?:
|
||||
| "raw" // default; use for regular relative or absolute paths
|
||||
| "obsidian-absolute" // use for Obsidian-style absolute paths (with no leading slash)
|
||||
| "obsidian-short"; // use for Obsidian-style shortened paths (shortest path possible)
|
||||
| "raw" // default; use for regular relative or absolute paths
|
||||
| "obsidian-absolute" // use for Obsidian-style absolute paths (with no leading slash)
|
||||
| "obsidian-short"; // use for Obsidian-style shortened paths (shortest path possible)
|
||||
permalinks?: string[]; // list of permalinks to match possible permalinks of a wiki link against
|
||||
wikiLinkResolver?: (name: string) => string[]; // function to resolve wiki links to an array of possible permalinks
|
||||
newClassName?: string; // class name to add to links that don't have a matching permalink
|
||||
@@ -108,16 +108,7 @@ function html(opts: HtmlOptions = {}) {
|
||||
if (isEmbed) {
|
||||
const [isSupportedFormat, format] = isSupportedFileFormat(target);
|
||||
if (!isSupportedFormat) {
|
||||
// Temporarily render note transclusion as a regular wiki link
|
||||
if (!format) {
|
||||
this.tag(
|
||||
`<a href="${hrefTemplate(link + headingId)}" class="${classNames} transclusion">`
|
||||
);
|
||||
this.raw(displayName);
|
||||
this.tag("</a>");
|
||||
} else {
|
||||
this.raw(`![[${target}]]`);
|
||||
}
|
||||
this.raw(`![[${target}]]`);
|
||||
} else if (format === "pdf") {
|
||||
this.tag(
|
||||
`<iframe width="100%" src="${hrefTemplate(
|
||||
|
||||
@@ -309,16 +309,4 @@ describe("micromark-extension-wiki-link", () => {
|
||||
expect(serialized).toBe('<p><a href="/" class="internal">/index</a></p>');
|
||||
});
|
||||
});
|
||||
|
||||
describe("transclusions", () => {
|
||||
test("parsers a transclusion as a regular wiki link", () => {
|
||||
const serialized = micromark("![[Some Page]]", "ascii", {
|
||||
extensions: [syntax()],
|
||||
htmlExtensions: [html() as any], // TODO type fix
|
||||
});
|
||||
expect(serialized).toBe(
|
||||
'<p><a href="Some Page" class="internal new transclusion">Some Page</a></p>'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -535,28 +535,4 @@ describe("remark-wiki-link", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("transclusions", () => {
|
||||
test("replaces a transclusion with a regular wiki link", () => {
|
||||
const processor = unified().use(markdown).use(wikiLinkPlugin);
|
||||
|
||||
let ast = processor.parse("![[Some Page]]");
|
||||
ast = processor.runSync(ast);
|
||||
|
||||
expect(select("wikiLink", ast)).not.toEqual(null);
|
||||
|
||||
visit(ast, "wikiLink", (node: Node) => {
|
||||
expect(node.data?.isEmbed).toEqual(true);
|
||||
expect(node.data?.exists).toEqual(false);
|
||||
expect(node.data?.permalink).toEqual("Some Page");
|
||||
expect(node.data?.alias).toEqual(null);
|
||||
expect(node.data?.hName).toEqual("a");
|
||||
expect((node.data?.hProperties as any).className).toEqual(
|
||||
"internal new transclusion"
|
||||
);
|
||||
expect((node.data?.hProperties as any).href).toEqual("Some Page");
|
||||
expect((node.data?.hChildren as any)[0].value).toEqual("Some Page");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useEffect, useState } from 'react';
|
||||
const Stat = ({ title, value, ...props }) => {
|
||||
return (
|
||||
<div {...props}>
|
||||
<span className="text-4xl sm:text-6xl font-bold text-secondary">{value}</span>
|
||||
<span className="text-6xl font-bold text-secondary">{value}</span>
|
||||
<p className="text-lg font-medium">{title}</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -86,7 +86,7 @@ export default function Layout({
|
||||
<>
|
||||
{title && <NextSeo title={title} description={description} />}
|
||||
<Nav />
|
||||
<div className="mx-auto p-2 sm:p-6 bg-background dark:bg-background-dark">
|
||||
<div className="mx-auto p-6 bg-background dark:bg-background-dark">
|
||||
{isHomePage && <Hero />}
|
||||
|
||||
<div className="relative mx-auto flex max-w-8xl justify-center sm:px-2 lg:px-8 xl:px-12">
|
||||
|
||||
@@ -92,7 +92,7 @@ export default function MobileNavigation({ navigation }) {
|
||||
>
|
||||
{/* <Logomark className="h-9 w-9" /> */}
|
||||
<div className="font-extrabold text-slate-900 dark:text-white text-2xl ml-6">
|
||||
PortalJS
|
||||
{siteConfig.title}
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -95,10 +95,7 @@ export default function Nav() {
|
||||
<MobileNavigation navigation={siteConfig.navLinks} />
|
||||
</div>
|
||||
<div className="flex flex-none items-center">
|
||||
<div className="hidden sm:block">
|
||||
<NavbarTitle />
|
||||
</div>
|
||||
|
||||
<NavbarTitle />
|
||||
<div className="hidden lg:flex ml-8 mr-6 sm:mr-8 md:mr-0">
|
||||
{siteConfig.navLinks.map((item) => (
|
||||
<NavItem item={item} key={item.name} />
|
||||
@@ -126,8 +123,9 @@ export default function Nav() {
|
||||
)}
|
||||
{siteConfig.github && (
|
||||
<div className="mt-1">
|
||||
{/* @ts-ignore */}
|
||||
<GitHubButton
|
||||
<
|
||||
// @ts-ignore
|
||||
GitHubButton
|
||||
href={siteConfig.github}
|
||||
data-color-scheme="no-preference: light; light: light; dark: dark;"
|
||||
data-size="large"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: 'Creating new datasets'
|
||||
description: 'Learn how to create new datasets and an index for all datasets on a data portal built with PortalJS'
|
||||
description: 'PortalJS Tutorial II - Learn how to create new datasets on a data portal'
|
||||
---
|
||||
|
||||
So far, the PortalJS app we created only has a single page displaying a dataset. Data catalogs and data portals generally showcase many different datasets.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: Deploying your PortalJS app
|
||||
description: 'Learn how to deploy PortalJS apps to Vercel and Cloudflare'
|
||||
---
|
||||
<NextSeo title="Deploying your PortalJS app - PortalJS" />
|
||||
|
||||
# Deploying your PortalJS app
|
||||
|
||||
Finally, let's learn how to deploy PortalJS apps to Vercel or Cloudflare Pages.
|
||||
|
||||
@@ -36,7 +35,7 @@ When you deploy, your PortalJS app will start building. It should finish in unde
|
||||
|
||||
When it’s done, you’ll get deployment URLs. Click on one of the URLs and you should see your PortalJS app live.
|
||||
|
||||
> [!tip]
|
||||
>[!tip]
|
||||
> You can find a more in-depth explanation about this process at https://nextjs.org/learn/basics/deploying-nextjs-app/deploy
|
||||
|
||||
### One-Click Deploy
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Getting Started
|
||||
description: 'Getting started guide and tutorial about data portal-building with PortalJS!'
|
||||
description: 'Getting started guide and tutorial about data portal-building with PortalJS'
|
||||
---
|
||||
|
||||
Welcome to the PortalJS documentation!
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: Searching datasets
|
||||
description: 'Learn how to create a searchable datasets index with facets on a PortalJs data portal'
|
||||
---
|
||||
<NextSeo title="Searching datasets - PortalJS" />
|
||||
|
||||
# Searching datasets
|
||||
|
||||
Typing out every link in the index page will get cumbersome eventually, and as the portal grows, finding the datasets you are looking for on the index page will become harder and harder, for that we will need search functionality.
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
title: Showing metadata
|
||||
description: "Learn how to display metadata on the dataset page of a data portal built with PortalJS"
|
||||
---
|
||||
<NextSeo title="Showing metadata - PortalJS" />
|
||||
|
||||
# Showing metadata
|
||||
|
||||
If you go now to `http://localhost:3000/my-awesome-dataset`, you will see that we now have two titles on the page. That's because `title` is one of the default metadata fields supported by PortalJS.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: How to add Google Analytics?
|
||||
description: Learn how to implement Google Analytics on PortalJS data portals
|
||||
description: Learn to implement Google Analytics on PortalJS data portals
|
||||
---
|
||||
|
||||
>[!todo] Prerequisites
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: How to add a simple blog?
|
||||
description: Learn how to add a simple blog on a PortalJS data portal
|
||||
description: How to add a simple blog on a PortalJS data portal
|
||||
---
|
||||
|
||||
## Setup
|
||||
@@ -16,15 +16,15 @@ npm i @portaljs/core
|
||||
Add the following code to the Next.js page that is going to be your blog home page, e.g. to `/pages/blog/index.tsx`:
|
||||
|
||||
```tsx
|
||||
import { BlogsList, SimpleLayout } from '@portaljs/core';
|
||||
import { BlogsList, SimpleLayout } from "@portaljs/core";
|
||||
|
||||
// pass a list of blogs, home page title and home page description, e.g. from `getStaticProps`
|
||||
export default function BlogIndex({ blogs, title, description }) {
|
||||
return (
|
||||
<SimpleLayout title={title} description={description}>
|
||||
<BlogsList blogs={blogs} />
|
||||
</SimpleLayout>
|
||||
);
|
||||
return (
|
||||
<SimpleLayout title={title} description={description}>
|
||||
<BlogsList blogs={blogs} />
|
||||
</SimpleLayout>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
@@ -32,16 +32,16 @@ export default function BlogIndex({ blogs, title, description }) {
|
||||
|
||||
```ts
|
||||
interface BlogsListProps {
|
||||
blogs: Blog;
|
||||
blogs: Blog;
|
||||
}
|
||||
|
||||
interface Blog {
|
||||
title: string;
|
||||
date: string;
|
||||
urlPath: string;
|
||||
description?: string;
|
||||
authors?: Array<string>;
|
||||
tags?: Array<string>;
|
||||
title: string;
|
||||
date: string;
|
||||
urlPath: string;
|
||||
description?: string;
|
||||
authors?: Array<string>;
|
||||
tags?: Array<string>;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -57,7 +57,7 @@ export default BlogPost({ content, title, date, authors }) {
|
||||
<BlogLayout title={title} date={date} authors={authors}
|
||||
{content}
|
||||
</BlogLayout>
|
||||
)
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
@@ -65,14 +65,14 @@ export default BlogPost({ content, title, date, authors }) {
|
||||
|
||||
```ts
|
||||
interface BlogLayoutProps {
|
||||
title?: string;
|
||||
date?: string;
|
||||
authors?: Array<Author>;
|
||||
title?: string;
|
||||
date?: string;
|
||||
authors?: Array<Author>;
|
||||
}
|
||||
|
||||
interface Author {
|
||||
name: string;
|
||||
avatar: string; // avatar image path
|
||||
urlPath?: string; // author page
|
||||
name: string;
|
||||
avatar: string; // avatar image path
|
||||
urlPath?: string; // author page
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: How to customize page metadata for SEO?
|
||||
description: Learn how to customize page metadata for SEO on data portals built with PortalJS
|
||||
description: Learn to customize page metadata for SEO on data portals with PortalJS
|
||||
---
|
||||
|
||||
>[!info]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: How to build a sitemap?
|
||||
description: Learn how to build a sitemap for a data portal built with PortalJS
|
||||
description: Learn how to build a sitemap for a data portal with PortalJS
|
||||
---
|
||||
|
||||
## Setup
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import Layout from '@/components/Layout';
|
||||
import { NextSeo } from 'next-seo';
|
||||
import Link from 'next/link';
|
||||
|
||||
export default function () {
|
||||
return (
|
||||
<>
|
||||
<NextSeo noindex={true} nofollow={true} />
|
||||
<Layout>
|
||||
<div className="flex items-center justify-center h-full">
|
||||
<div className="text-center">
|
||||
<h1 className="text-2xl">404 - Page not found</h1>
|
||||
<p className="text-lg mt-5">
|
||||
It seems like you are looking for a page that doesn't exist.
|
||||
</p>
|
||||
<Link className="underline" href="/">
|
||||
Go back to home
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import { CustomAppProps } from './_app.jsx';
|
||||
import computeFields from '@/lib/computeFields';
|
||||
import { getAuthorsDetails } from '@/lib/getAuthorsDetails';
|
||||
import JSONLD from '@/components/JSONLD';
|
||||
import { BreadcrumbJsonLd } from 'next-seo';
|
||||
|
||||
export default function Page({ source, meta, sidebarTree }) {
|
||||
source = JSON.parse(source);
|
||||
@@ -30,19 +29,9 @@ export default function Page({ source, meta, sidebarTree }) {
|
||||
setTableOfContents(toc ?? []);
|
||||
}, [router.asPath]); // update table of contents on route change with next/link
|
||||
|
||||
const urlSegments = meta.urlPath.split('/');
|
||||
const breadcrumbs = urlSegments.map((segment, i) => {
|
||||
return {
|
||||
position: i + 1,
|
||||
name: i == urlSegments.length - 1 ? meta.title || segment : segment,
|
||||
item: '/' + urlSegments.slice(0, i + 1).join('/'),
|
||||
};
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<JSONLD meta={meta} source={source.compiledSource} />
|
||||
<BreadcrumbJsonLd itemListElements={breadcrumbs} />
|
||||
<Layout
|
||||
tableOfContents={tableOfContents}
|
||||
title={meta.title}
|
||||
|
||||
Reference in New Issue
Block a user