Moving Tag to Top
Overview
This is still not implemented correctly. Still a working progress.
This guide explains how to move tags from the bottom of documentation pages to just below the title and metadata (Updated/Reading time) for tablet, desktop, laptop, and larger screen sizes.
Features:
- Tags appear below title and metadata on larger screens
- Original bottom tags hidden on larger screens
- Mobile experience unchanged (tags remain at bottom)
- No "Tags" label - just the tag elements
- Uses native Docusaurus TagsListInline component
- Responsive breakpoint at 768px
Directory Structure
src/
├── theme/
│ └── DocItem/
│ ├── Header/
│ │ └── index.js
│ └── Content/
│ └── index.js
└── css/
└── custom.scss
Files modified/created:
src/theme/DocItem/Header/index.js- Custom header componentsrc/theme/DocItem/Content/index.js- Custom content componentsrc/css/custom.scss- Responsive CSS rules
Implementation
-
Custom Theme Components
Created custom theme components to override Docusaurus default behavior:
-
CSS Styling
Added responsive CSS to control tag visibility:
// src/css/custom.scss
/* Move tags to top on larger screens */
@media (min-width: 768px) {
.theme-doc-footer-tags-row {
display: none;
}
.custom-tags-header {
display: block;
}
}
@media (max-width: 767px) {
.custom-tags-header {
display: none;
}
}
How It Works
-
Component Swizzling: Uses Docusaurus theme swizzling to override default components
-
Header Wrapper: Adds tags after the document header (title, metadata)
-
Content Wrapper: Alternative approach for adding tags at content level
-
Responsive Design: Shows tags at top only on screens ≥768px wide
-
Hide Original: Hides the original bottom tags on larger screens
-
Preserve Mobile: Keeps original tag placement on mobile devices
Breakpoints
This implementation ensures tags are repositioned only for larger screens while maintaining the original mobile experience.
-
≥768px: Tags shown at top, hidden at bottom -
<768px: Original behavior (tags at bottom)