2024-09-29 18:09:44 +02:00
import { themes as prismThemes } from 'prism-react-renderer'
2025-04-21 18:20:52 +02:00
import { docusaurusPlugins } from './plugins/index.mjs'
2025-04-01 16:15:20 +02:00
import smartypants from 'remark-smartypants'
2024-09-29 18:09:44 +02:00
2024-10-06 13:06:43 +02:00
/ *
2025-04-01 16:15:20 +02:00
* We customize the sidebar somewhat :
* - We bundle the options as one page , so keep them out the sidebar
* - We hide certain dynamic pages ( like for measurements sets , patterns , and so on )
2024-10-06 13:06:43 +02:00
* /
2025-04-01 16:15:20 +02:00
function customizeSidebar ( items ) {
// Filter out design options
const docs = items . filter ( ( entry ) => entry . label === 'Docs' ) . pop ( ) . items
for ( const item in docs ) {
if ( docs [ item ] . label === 'FreeSewing Designs' ) {
for ( const design in docs [ item ] . items ) {
for ( const subpage in docs [ item ] . items [ design ] . items ) {
if ( docs [ item ] . items [ design ] . items [ subpage ] . label === 'Design Options' ) {
docs [ item ] . items [ design ] . items [ subpage ] . items = [ ]
2024-10-06 13:06:43 +02:00
}
}
}
}
2025-04-01 16:15:20 +02:00
if ( docs [ item ] . label === 'hidden' ) {
console . log ( docs [ item ] )
}
2024-10-06 13:06:43 +02:00
}
2025-04-01 16:15:20 +02:00
2025-05-18 10:02:47 +00:00
// Filter out submenus in Your Measurements Sets and Your Patterns
for ( const item in items ) {
if ( items [ item ] . label === 'Account' ) {
for ( const design in items [ item ] . items ) {
for ( const subpage in items [ item ] . items [ design ] . items ) {
if (
items [ item ] . items [ design ] . items [ subpage ] . label === 'Your Measurements Sets' ||
items [ item ] . items [ design ] . items [ subpage ] . label === 'Your Patterns'
) {
items [ item ] . items [ design ] . items [ subpage ] . items = [ ]
}
}
}
}
}
2024-10-06 13:06:43 +02:00
return items
}
2024-09-29 18:09:44 +02:00
const config = {
title : 'FreeSewing' ,
tagline : 'FreeSewing documentation for makers' ,
favicon : 'img/favicon.ico' ,
2025-04-21 18:20:52 +02:00
url : 'https://freesewing.eu' ,
2024-09-29 18:09:44 +02:00
baseUrl : '/' ,
2025-04-03 14:41:18 +00:00
// Not time to look into this now
onBrokenLinks : 'warn' ,
2024-09-29 18:09:44 +02:00
onBrokenMarkdownLinks : 'warn' ,
2025-04-01 16:15:20 +02:00
future : {
experimental _faster : false , // Too many bugs for now
} ,
2024-09-29 18:09:44 +02:00
plugins : [
2025-04-21 18:20:52 +02:00
... docusaurusPlugins ,
2024-11-18 11:05:16 +01:00
[
'@docusaurus/plugin-content-blog' ,
{
id : 'showcase' ,
routeBasePath : 'showcase' ,
path : './showcase' ,
authorsMapPath : '../authors.json' ,
postsPerPage : 50 ,
blogSidebarCount : 10 ,
blogSidebarTitle : 'Recent Showcases' ,
} ,
] ,
[
'@docusaurus/plugin-content-blog' ,
{
id : 'newsletter' ,
routeBasePath : 'newsletter' ,
path : './newsletter' ,
authorsMapPath : '../authors.json' ,
blogTitle : 'FreeSewing Newsletter' ,
blogDescription : 'Four times per year, honest wholesome content, no ads, no nonsense' ,
blogSidebarCount : 50 ,
blogSidebarTitle : 'Newsletter Editions' ,
postsPerPage : 10 ,
feedOptions : {
type : 'rss' ,
title : 'FreeSewing Newsletter Editions' ,
description : 'A feed for the FreeSewing newsletter' ,
copyright : 'FreeSewing' ,
language : 'en' ,
createFeedItems : async ( params ) => {
const { blogPosts , defaultCreateFeedItems , ... rest } = params
return defaultCreateFeedItems ( {
blogPosts : blogPosts . filter ( ( item , index ) => index < 10 ) ,
... rest ,
} )
} ,
} ,
} ,
] ,
2024-09-29 18:09:44 +02:00
] ,
i18n : { defaultLocale : 'en' , locales : [ 'en' ] } ,
presets : [
[
'classic' ,
{
docs : {
2025-04-21 18:20:52 +02:00
routeBasePath : '/' ,
2024-09-29 18:09:44 +02:00
sidebarPath : './sidebars.js' ,
2025-04-06 17:29:52 +02:00
editUrl : 'https://codeberg.org/freesewing/freesewing/src/branch/develop/sites/org/' ,
2024-10-06 13:06:43 +02:00
async sidebarItemsGenerator ( { defaultSidebarItemsGenerator , ... args } ) {
const sidebarItems = await defaultSidebarItemsGenerator ( args )
2025-04-01 16:15:20 +02:00
return customizeSidebar ( sidebarItems )
2024-10-06 13:06:43 +02:00
} ,
2025-04-01 16:15:20 +02:00
remarkPlugins : [ [ smartypants , { dashes : 'oldschool' } ] ] ,
2024-09-29 18:09:44 +02:00
} ,
theme : {
customCss : './src/css/custom.css' ,
} ,
2024-11-18 11:05:16 +01:00
blog : {
path : 'blog' ,
// Simple use-case: string editUrl
2025-04-06 17:29:52 +02:00
editUrl : 'https://codeberg.org/freesewing/freesewing/src/branch/develop/sites/org/' ,
2024-11-18 11:05:16 +01:00
editLocalizedFiles : false ,
blogTitle : 'FreeSewing Blog' ,
blogDescription : 'News and updates from the people behind FreeSewing' ,
blogSidebarCount : 5 ,
blogSidebarTitle : 'Recent blog posts' ,
routeBasePath : 'blog' ,
authorsMapPath : '../authors.json' ,
include : [ '*/index.mdx' ] ,
exclude : [
'**/_*.{js,jsx,ts,tsx,md,mdx}' ,
'**/_*/**' ,
'**/*.test.{js,jsx,ts,tsx}' ,
'**/__tests__/**' ,
] ,
postsPerPage : 10 ,
blogListComponent : '@theme/BlogListPage' ,
blogTagsListComponent : '@theme/BlogTagsListPage' ,
blogTagsPostsComponent : '@theme/BlogTagsPostsPage' ,
2025-04-01 16:15:20 +02:00
remarkPlugins : [ [ smartypants , { dashes : 'oldschool' } ] ] ,
2024-11-18 11:05:16 +01:00
truncateMarker : /<!--\s*(truncate)\s*-->/ ,
showReadingTime : true ,
feedOptions : {
type : 'rss' ,
title : 'FreeSewing Blog Posts' ,
description : 'News and updates from the people behind FreeSewing' ,
copyright : 'FreeSewing' ,
language : 'en' ,
createFeedItems : async ( params ) => {
const { blogPosts , defaultCreateFeedItems , ... rest } = params
return defaultCreateFeedItems ( {
// keep only the 10 most recent blog posts in the feed
blogPosts : blogPosts . filter ( ( item , index ) => index < 10 ) ,
... rest ,
} )
} ,
} ,
} ,
2024-09-29 18:09:44 +02:00
} ,
] ,
] ,
themeConfig : {
2025-04-03 14:41:18 +00:00
colorMode : {
2025-04-18 08:07:13 +00:00
// Do not be tempted to change these
disableSwitch : true ,
respectPrefersColorScheme : true ,
2025-04-03 14:41:18 +00:00
} ,
2024-09-29 18:09:44 +02:00
image : 'img/freesewing-social-card.png' ,
navbar : {
title : 'FreeSewing' ,
logo : {
alt : 'FreeSewing Logo' ,
2024-11-18 11:05:16 +01:00
src : 'img/logo.svg' ,
2024-09-29 18:09:44 +02:00
} ,
items : [
2025-04-01 16:15:20 +02:00
{ type : 'custom-FreeSewingNavbarItem' , position : 'left' , id : 'designs' } ,
{ type : 'custom-FreeSewingNavbarItem' , position : 'left' , id : 'docs' } ,
{ type : 'custom-FreeSewingNavbarItem' , position : 'left' , id : 'showcase' } ,
{ type : 'custom-FreeSewingNavbarItem' , position : 'left' , id : 'blog' } ,
2025-04-03 14:41:18 +00:00
{ type : 'custom-FreeSewingNavbarItem' , position : 'left' , id : 'forum' } ,
2025-04-01 16:15:20 +02:00
{ type : 'custom-FreeSewingNavbarItem' , position : 'right' , id : 'account' } ,
2025-05-31 18:38:32 +02:00
{ type : 'custom-FreeSewingNavbarItem' , position : 'right' , id : 'support' } ,
2024-09-29 18:09:44 +02:00
] ,
} ,
footer : {
style : 'light' ,
links : [
{
2025-04-01 16:15:20 +02:00
title : 'Sections' ,
2024-09-29 18:09:44 +02:00
items : [
2025-04-01 16:15:20 +02:00
{ label : 'FreeSewing Designs' , to : '/designs/' } ,
{ label : 'FreeSewing Showcase' , to : '/showcase/' } ,
{ label : 'FreeSewing Blog' , to : '/blog/' } ,
{ label : 'FreeSewing Editor' , to : '/editor/' } ,
2025-04-03 14:41:18 +00:00
{ label : 'Curated Measurements Sets' , to : '/curated-sets/' } ,
2024-09-29 18:09:44 +02:00
] ,
} ,
{
title : 'Help & Support' ,
items : [
2025-04-01 16:15:20 +02:00
{ label : 'About FreeSewing' , to : '/docs/about/' } ,
{ label : 'Getting Started' , to : '/docs/about/guide/' } ,
{ label : 'Frequently Asked Questions' , href : '/docs/about/faq/' } ,
2025-04-03 14:41:18 +00:00
{ label : 'Documentation' , href : '/docs/' } ,
2025-04-01 16:15:20 +02:00
{ label : 'Need Help?' , href : '/support' } ,
2024-09-29 18:09:44 +02:00
] ,
} ,
{
title : 'More' ,
items : [
2025-04-03 14:41:18 +00:00
{ label : 'FreeSewing.eu' , to : 'https://freesewing.eu/' } ,
2025-04-01 16:15:20 +02:00
{ label : 'FreeSewing.dev' , to : 'https://freesewing.dev/' } ,
{ label : 'FreeSewing.social' , to : 'https://freesewing.social/' } ,
2025-04-03 14:41:18 +00:00
{ label : 'Code on Codeberg' , to : 'https://codeberg.org/freesewing/freesewing' } ,
2025-04-01 16:15:20 +02:00
{ label : 'FreeSewing Revenue Pledge 💜' , href : '/docs/about/pledge/' } ,
2024-09-29 18:09:44 +02:00
] ,
} ,
] ,
2025-04-06 17:29:52 +02:00
copyright : ` <a href="https://freesewing.org/">FreeSewing</a> is brought to you by <a href="https://codeberg.org/joostdecock">Joost De Cock</a> and <a href="https://codeberg.org/freesewing/freesewing/src/branch/develop/CONTRIBUTORS.md">contributors</a> with the financial support of <a href="/patrons/join">our patrons</a> ` ,
2024-09-29 18:09:44 +02:00
} ,
prism : {
theme : prismThemes . dracula ,
darkTheme : prismThemes . dracula ,
} ,
} ,
}
export default config