Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/[[...mdxPath]]/page.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { generateStaticParamsFor, importPage } from 'nextra/pages'
import { useMDXComponents as getMDXComponents } from '../../mdx-components'
import { pageMetadata } from '@/lib/seo'

export const generateStaticParams = generateStaticParamsFor('mdxPath')

export async function generateMetadata(props) {
const params = await props.params
const { metadata } = await importPage(params.mdxPath)
return metadata
const route = params.mdxPath?.length ? `/${params.mdxPath.join('/')}` : '/'
return {
...metadata,
...pageMetadata({ route, title: metadata.title, description: metadata.description })
}
}

const Wrapper = getMDXComponents().wrapper
Expand Down
15 changes: 11 additions & 4 deletions app/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'nextra-theme-docs/style.css'
import './globals.css'
import { SiteLogo } from '@/components/brand/seal'
import { SiteFooter } from '@/components/site/site-footer'
import { OG_IMAGE, SITE_DESCRIPTION, SITE_NAME, SITE_URL } from '@/lib/seo'

// Atkinson Hyperlegible Next and Mono: designed so that 0/O and 1/l/I never
// look alike, which matters on a site full of keys, digests and IDs.
Expand Down Expand Up @@ -40,12 +41,18 @@ const codeFont = localFont({
})

export const metadata = {
metadataBase: new URL(SITE_URL),
title: {
default: 'Selcom Developers',
template: '%s | Selcom Developers'
default: SITE_NAME,
template: `%s | ${SITE_NAME}`
},
description:
'Open-source community clients for the Selcom payment API in Java, Node.js, Python, PHP and Laravel. Not affiliated with Selcom Paytech Ltd.'
description: SITE_DESCRIPTION,
// Pages set their own openGraph (see app/[[...mdxPath]]/page.jsx). The card
// has no title or description here, so X falls back to each page's og: tags.
twitter: {
card: 'summary_large_image',
images: [OG_IMAGE.url]
}
}

const navbar = (
Expand Down
8 changes: 8 additions & 0 deletions app/robots.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const dynamic = 'force-static'

export default function robots() {
return {
rules: { userAgent: '*', allow: '/' },
sitemap: 'https://selcom-developers.github.io/sitemap.xml'
}
}
27 changes: 27 additions & 0 deletions app/sitemap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import fs from 'node:fs'
import path from 'node:path'

export const dynamic = 'force-static'

const SITE = 'https://selcom-developers.github.io'
const CONTENT = path.join(process.cwd(), 'content')

// One entry per page under content/: "index.mdx" maps to its folder's path.
function pages(dir, prefix = '') {
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
if (entry.isDirectory()) return pages(path.join(dir, entry.name), `${prefix}/${entry.name}`)
if (!/\.mdx?$/.test(entry.name)) return []
const name = entry.name.replace(/\.mdx?$/, '')
return [name === 'index' ? prefix || '/' : `${prefix}/${name}`]
})
}

export default function sitemap() {
return pages(CONTENT)
.sort()
.map((route) => ({
url: route === '/' ? `${SITE}/` : `${SITE}${route}`,
changeFrequency: 'monthly',
priority: route === '/' ? 1 : route.split('/').length === 2 ? 0.8 : 0.6
}))
}
4 changes: 4 additions & 0 deletions content/community/links.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ Our community clients are separate. They are written from scratch and do not cop
- [selcom-spec](https://github.com/selcom-developers/selcom-spec)
- [Contributing](/community/contributing)
- [Security reporting](/community/security)

## Other African payment APIs

- [Malipo](https://alphaolomi.github.io/awesome-payment-integrations/): a curated directory of African payment providers with usable APIs, and the SDKs for them.
30 changes: 30 additions & 0 deletions lib/seo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Shared metadata for link previews and search engines.
export const SITE_URL = 'https://selcom-developers.github.io'
export const SITE_NAME = 'Selcom Developers'
export const SITE_DESCRIPTION =
'Open-source community clients for the Selcom payment API in Java, Node.js, Python, PHP and Laravel. Not affiliated with Selcom Paytech Ltd.'

export const OG_IMAGE = {
url: '/og.png',
width: 1200,
height: 630,
alt: 'Selcom Developers: community clients for the Selcom payment API'
}

// Open Graph and canonical metadata for one page. Next.js replaces a parent's
// openGraph object rather than merging it, so every page sets the full object.
export function pageMetadata({ route, title, description }) {
const isHome = route === '/'
return {
alternates: { canonical: route },
openGraph: {
type: 'website',
siteName: SITE_NAME,
locale: 'en',
url: route,
title: isHome || !title ? SITE_NAME : `${title} | ${SITE_NAME}`,
description: description || SITE_DESCRIPTION,
images: [OG_IMAGE]
}
}
}
Binary file added public/og.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.