mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-26 12:54:12 +03:00
Add Universe index page
This commit is contained in:
parent
a2fc7ecb27
commit
7dac26df38
17
website/pages/universe/index.tsx
Normal file
17
website/pages/universe/index.tsx
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import recordSections from '../../meta/recordSections'
|
||||||
|
import Layout from '../../src/templates'
|
||||||
|
|
||||||
|
const Universe = () => {
|
||||||
|
return (
|
||||||
|
<Layout
|
||||||
|
slug={'/universe'}
|
||||||
|
section="universe"
|
||||||
|
sectionTitle={recordSections.universe.title}
|
||||||
|
theme={recordSections.universe.theme}
|
||||||
|
isIndex
|
||||||
|
title="Overview"
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Universe
|
|
@ -21,12 +21,6 @@ import { github, MarkdownToReact } from '../components/util'
|
||||||
import { nightly, legacy } from '../../meta/dynamicMeta'
|
import { nightly, legacy } from '../../meta/dynamicMeta'
|
||||||
import universe from '../../meta/universe.json'
|
import universe from '../../meta/universe.json'
|
||||||
|
|
||||||
function getSlug(data) {
|
|
||||||
if (data.isCategory) return `/universe/category/${data.id}`
|
|
||||||
if (data.isProject) return `/universe/project/${data.id}`
|
|
||||||
return `/universe`
|
|
||||||
}
|
|
||||||
|
|
||||||
function filterResources(resources, data) {
|
function filterResources(resources, data) {
|
||||||
const sorted = resources.sort((a, b) => a.id.localeCompare(b.id))
|
const sorted = resources.sort((a, b) => a.id.localeCompare(b.id))
|
||||||
if (!data || !data.isCategory) return sorted
|
if (!data || !data.isCategory) return sorted
|
||||||
|
@ -38,7 +32,7 @@ const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComp
|
||||||
const filteredResources = filterResources(content, data)
|
const filteredResources = filterResources(content, data)
|
||||||
const activeData = data ? content.find(({ id }) => id === data.id) : null
|
const activeData = data ? content.find(({ id }) => id === data.id) : null
|
||||||
const markdownComponents = { ...mdxComponents, code: InlineCode }
|
const markdownComponents = { ...mdxComponents, code: InlineCode }
|
||||||
const slug = getSlug(data)
|
const slug = pageContext.slug
|
||||||
const isHome = !data.isCategory && !data.isProject
|
const isHome = !data.isCategory && !data.isProject
|
||||||
|
|
||||||
const sidebar = [
|
const sidebar = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user