### Serve Docs.MyBB.com Locally with Local Theme using Docker Source: https://github.com/mybb/docs.mybb.com/blob/gh-pages/README.md This command serves the website locally with Docker, additionally mounting a local theme from a sibling directory. This is useful for previewing changes made to the 'mybb-website-theme'. ```shell $ docker run -it --rm -p "4000:4000" -v "${PWD}:/usr/src/app" -v "${PWD}/../mybb-website-theme:/usr/src/app/_themes/theme" mybb/jekyll-docker ``` -------------------------------- ### Serve Docs.MyBB.com Locally with Docker Source: https://github.com/mybb/docs.mybb.com/blob/gh-pages/README.md Use this command to serve the website locally using Docker. Ensure Docker has file sharing permissions for the directory. The website will be accessible at https://127.0.0.1:4000. ```shell $ docker run -it --rm -p "4000:4000" -v "${PWD}:/usr/src/app" mybb/jekyll-docker ``` -------------------------------- ### Branch Switch Logic Implementation Source: https://github.com/mybb/docs.mybb.com/blob/gh-pages/_includes/branch_switch.html This Liquid template code determines the current branch and iterates through site data to build navigation links for other branches. It's used to create a dynamic branch switcher. ```html {% assign pageDirs = page.dir | split: '/' %} {% assign pageBranch = pageDirs[1] %} {% assign pageCount = 0 %} {% capture branchSwitch %} {% if site.data.branches contains pageBranch %} {% assign pageBranchUrlPrefix = '/' | append: pageBranch %} {% assign branchlessUrl = page.url | remove_first: pageBranchUrlPrefix %} Series {% for branch in site.data.branches %} {% assign branchUrl = '/' | append: branch[0] | append: branchlessUrl %} {% assign branchPage = site.pages | where: "url", branchUrl | first %} {% if branchPage %} {% assign pageCount = pageCount | plus: 1 %} [{{ branch[0] }}]({{ branchPage.url }}) {% endif %} {% endfor %} {% endif %} {% endcapture %} {% if pageCount > 1 %} {{ branchSwitch }} {% endif %} ``` -------------------------------- ### Category Page Listing Logic Source: https://github.com/mybb/docs.mybb.com/blob/gh-pages/_includes/category.html This Liquid template code iterates through site pages, sorts them, filters by category, and checks for existence in newer branches to conditionally display page links and descriptions. It's used to build dynamic category listings. ```html {% assign i = 0 %} {% if include.sort == 'order' %} {% assign sorted_pages = site.pages | sort:"order" %} {% else %} {% assign sorted_pages = site.pages | sort:"name" %} {% endif %} {% for catpage in sorted_pages %} {% for pc in catpage.categories %} {% if pc == include.category %} {% assign existsInNewerBranch = false %} {% assign pageDirs = catpage.dir | split: '/' %} {% assign pageBranch = pageDirs[1] %} {% if site.data.branches contains pageBranch %} {% assign afterPageBranch = false %} {% assign pageBranchUrlPrefix = '/' | append: pageBranch %} {% assign branchlessUrl = catpage.url | remove_first: pageBranchUrlPrefix %} {% for branch in site.data.branches %} {% assign branchUrl = '/' | append: branch[0] | append: branchlessUrl %} {% assign branchPage = site.pages | where: "url", branchUrl | first %} {% if branchPage %} {% if afterPageBranch == true %} {% assign existsInNewerBranch = true %} {% elsif branch[0] == pageBranch %} {% assign afterPageBranch = true %} {% endif %} {% endif %} {% endfor %} {% endif %} {% unless existsInNewerBranch %} {% if include.style == 'big' %}* [{{ catpage.title }}]({{ site.baseurl }}{{ catpage.url }}) {% if catpage.description != "" %} {{ catpage.description }} {% endif %} {% else %}* [{{ catpage.title }}]({{ site.baseurl }}{{ catpage.url }}) {% endif %} {% endunless %} {% endif %} {% endfor %} {% endfor %} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.