---
import MoreMenu from '../RightSidebar/MoreMenu.astro';
import TableOfContents from '../RightSidebar/TableOfContents.tsx';
import { getLanguageFromURL } from '../../util.ts';
import { SIDEBAR } from '../../config.ts';
const { content, githubEditUrl, currentPage } = Astro.props;
const title = content.title;
const headers = content.astro?.headers;
const langCode = getLanguageFromURL(currentPage);
const links = SIDEBAR[langCode].filter(
(x) => x.link && typeof x.header === 'undefined'
);
// handle cases with a trailing slash or not
const index = links.findIndex(
(x) => `/${x.link}/` === currentPage || `/${x.link}` === currentPage
);
const next =
index !== -1 ? (index === links.length - 1 ? null : links[index + 1]) : null;
const previous = index !== -1 ? (index === 0 ? null : links[index - 1]) : null;
---
{(previous || next) && (
)}