Skip to content

How to hide the blog sidebar? #10856

Closed Answered by slorber
tisonkun asked this question in Q&A
Jan 22, 2025 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Swizzle BlogLayout and customize it to your needs, for example removing the <BlogSidebar> component usage depending on your own custom logic (you show for some pages, and hide for others for example)

import React, {type ReactNode} from 'react';
import clsx from 'clsx';
import Layout from '@theme/Layout';
import BlogSidebar from '@theme/BlogSidebar';

import type {Props} from '@theme/BlogLayout';

export default function BlogLayout(props: Props): ReactNode {
  const {sidebar, toc, children, ...layoutProps} = props;
  const hasSidebar = sidebar && sidebar.items.length > 0;

  return (
    <Layout {...layoutProps}>
      <div className="container margin-vert--lg">
        <div className="row">

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tisonkun
Comment options

@slorber
Comment options

slorber Jan 23, 2025
Collaborator

Answer selected by tisonkun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants