Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/boss-guides/afk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Redirecting...
---

<meta http-equiv="refresh" content="0; url=/pvme-guides/afk/afk-overview/" />
5 changes: 5 additions & 0 deletions docs/boss-guides/basic-guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Redirecting...
---

<meta http-equiv="refresh" content="0; url=/pvme-guides/basic-guides/aod-basic/" />
5 changes: 5 additions & 0 deletions docs/boss-guides/combat-achievements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Redirecting...
---

<meta http-equiv="refresh" content="0; url=/pvme-guides/combat-achievements/aodca/" />
54 changes: 54 additions & 0 deletions docs/boss-guides/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
hide:
- toc

hide_actions: true
---
# Boss & Slayer Guides - Directory

<div class="grid cards">
<ul>
<li>
<a href="/boss-guides/basic-guides/">
<h2><strong>Basic Guides</strong></h2>
<hr>
<p>Just getting into with PVM? Start here!</p>
</a>
</li>
<li>
<a href="/boss-guides/rs3-full-boss-guides/">
<h2><strong>Full Boss & Slayer Guides</strong></h2>
<hr>
<p>From presets to rotations, learn how to maximise your kills per hour at any boss in the game.</p>
</a>
</li>
<li>
<a href="/boss-guides/afk/">
<h2><strong>AFK Methods</strong></h2>
<hr>
<p>Need some downtime? Don't want to actively kill a boss? A large number of bosses can be killed AFK.</p>
</a>
</li>
<li>
<a href="/boss-guides/combat-achievements/">
<h2><strong>Combat Achievements</strong></h2>
<hr>
<p>CAs can be really challenging! We're compiling the best of the best here.</p>
</a>
</li>
<li>
<a href="/boss-guides/slayer/">
<h2><strong>Slayer Guides</strong></h2>
<hr>
<p>Ultimate Slayer is one heck of a grind - discover ways to take on various mobs.</p>
</a>
</li>
<li>
<a href="/boss-guides/one-tick-guides/">
<h2><strong>One Tick Guides</strong></h2>
<hr>
<p>Want fast kills and set new personal bests?</p>
</a>
</li>
</ul>
</div>
5 changes: 5 additions & 0 deletions docs/boss-guides/one-tick-guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Redirecting...
---

<meta http-equiv="refresh" content="0; url=/pvme-guides/one-tick-guides/basic-one-ticks/" />
5 changes: 5 additions & 0 deletions docs/boss-guides/rs3-full-boss-guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Redirecting...
---

<meta http-equiv="refresh" content="0; url=/pvme-guides/rs3-full-boss-guides/angel-of-death-7s/mage-base/" />
5 changes: 5 additions & 0 deletions docs/boss-guides/slayer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Redirecting...
---

<meta http-equiv="refresh" content="0; url=/pvme-guides/slayer/overview-of-slayer/" />
27 changes: 27 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,31 @@ p {
/* Hide navigation emojis when the category is opened */
.md-nav__link .nav-emoji {
display: none;
}

.md-typeset .grid {
grid-gap: 1rem;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.md-typeset .grid.cards>ul>li {
padding: 0;
}

.md-typeset .grid li > a {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
color: var(--md-primary-bg-color);
padding: 0.8rem;
}

.md-typeset .grid li:hover > a {
color: var(--md-primary-fg-color);
}


.md-typeset .grid h2 {
margin: 0;
}
6 changes: 4 additions & 2 deletions gen_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
# 'afk/**/*.txt'
# ])

name_converter = NameConverter(settings.name_convert, settings.files.source_dir)
source_dir = Path(settings.files.source_dir).resolve() if settings.files.source_dir else Path("docs").resolve()

name_converter = NameConverter(settings.name_convert, source_dir)
page_generator = PageGenerator(files, name_converter, source_dir)

page_generator = PageGenerator(files, name_converter, settings.files.source_dir)
page_generator.generate_pages()
38 changes: 24 additions & 14 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ theme:
custom_dir: overrides
favicon: assets/logo.ico
features:
- navigation.instant
- navigation.tabs
- navigation.tabs.sticky
- navigation.instant
- navigation.indexes
- search.suggest
- search.highlight
# - search.share
- navigation.top
# - navigation.indexes
- announce.dismiss
- content.action.edit
palette:
Expand All @@ -33,10 +30,8 @@ theme:
icon: material/weather-sunny
name: Switch to dark mode


plugins:
- search
#- git-revision-date-localized
- macros
- gen-files:
scripts:
Expand All @@ -50,7 +45,8 @@ markdown_extensions:
- pymdownx.emoji
- admonition
- footnotes
# - pymdownx.extra (markdown formatting in HTMl blocks)
- attr_list
- md_in_html

extra_css:
- stylesheets/extra.css
Expand All @@ -61,9 +57,23 @@ extra_javascript:
- javascripts/discordInvite.js

nav:
- index.md
- About:
- Info: about/info.md
- Keyboard Shortcuts: about/shortcuts.md
- How The Site Works: about/workings.md
- Changelog: about/changelog.md
- Home: index.md
- Getting Started:
- New to PvM: new-to-pvm
- New to Bossing: new-to-bossing
- Invention & Perks: invention-and-perks
- Boss & Slayer Guides:
- Guide Directory: boss-guides/index.md
- Basic Guides: boss-guides/basic-guides.md
- RS3 Full Boss Guides: boss-guides/rs3-full-boss-guides.md
- AFK Methods: boss-guides/afk.md
- Combat Achievements: boss-guides/combat-achievements.md
- Slayer Guides: boss-guides/slayer.md
- One Tick Guides: boss-guides/one-tick-guides.md
- Strategy:
- DPM Advice: dpm-advice
- Upgrade Paths: upgrading-info
- Miscellaneous:
- PVME Mastery Roles: get-involved
- About PVME: about
- Editor Resources: editor-resources
99 changes: 84 additions & 15 deletions site_builder/navigation.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,93 @@
from typing import List, Union, Tuple
import yaml
import logging
from typing import List
from pathlib import Path
from collections import defaultdict

logging.basicConfig(level=logging.DEBUG, format="%(levelname)s:%(name)s:%(message)s")
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)

class NavStructure(dict):
def __setitem__(self, keys: List[str], value: Union[Tuple[str, str], str]):
cur = self
for key in keys:
cur = cur.setdefault(key, {})
cur[value[0]] = value[1]
# Load NAV structure from mkdocs.yml
def load_nav_from_mkdocs():
mkdocs_path = Path("mkdocs.yml")
with mkdocs_path.open("r", encoding="utf-8") as file:
config = yaml.safe_load(file)
return config.get("nav", [])

HARDCODED_NAV = load_nav_from_mkdocs()

class NavInterface:
def __init__(self, mkdocs_nav):
def __init__(self, mkdocs_nav, source_files, name_converter):
if mkdocs_nav is None:
raise ValueError("Error: MkDocs navigation is None. Ensure 'nav:' is properly initialized.")

self.__nav = mkdocs_nav
self.__structure = NavStructure()
self.__source_files = source_files
self.__name_converter = name_converter
self.__structure = defaultdict(lambda: defaultdict(list))

def get_nav_structure(self):
"""Returns the internal navigation structure."""
return self.__nav

def add_item(self, category_name, forum_name, channel_name, output_file):
keys = [category_name]
def add_item(self, category_name: str, forum_name: str, channel_name: str, output_file: str):
"""Ensures Level 2 appears first, then nests Level 3 pages under it properly."""
if forum_name:
keys.append(forum_name)
self.__structure[keys] = channel_name, output_file
self.__structure[category_name][forum_name].append({channel_name: output_file})
else:
self.__structure[category_name][channel_name] = output_file

def rebuild_nav(self, mkdocs_files):
"""Ensures that sub-pages are correctly collected and nested under their respective sections."""
logger.debug("🔍 Rebuilding MkDocs Navigation")

nav = []

# Force all paths to use forward slashes to avoid Windows path issues
all_md_files = [
Path(file.src_path).as_posix() for file in mkdocs_files if Path(file.src_path).suffix == ".md"
]
logger.debug(f"📄 ALL MkDocs Markdown Files: {all_md_files}")

# Iterate through all sections in HARDCODED_NAV
for section in HARDCODED_NAV:
if isinstance(section, dict):
# Look for the "Boss & Slayer Guides" section and process it
if "Boss & Slayer Guides" in section:
category_entries = section["Boss & Slayer Guides"]
logger.debug(f"📂 Found Boss & Slayer Guides Categories: {category_entries}")

boss_guides_section = {"Boss & Slayer Guides": []}

for entry in category_entries:
if isinstance(entry, dict):
for category, folder in entry.items():
# Convert section name to lowercase and replace spaces with hyphens for folder path
category_folder = category.lower().replace(" ", "-")

# Find all markdown files for this category and subfolders (excluding 'index.md' for redirects)
category_guides = sorted(
[file for file in all_md_files if f"pvme-guides/{category_folder}/" in file and "index.md" not in file]
)

# Check if category guides are found, if so, add them
if category_guides:
boss_guides_section["Boss & Slayer Guides"].append({category: category_guides})
logger.debug(f"📌 Added {len(category_guides)} guides under '{category}'.")
else:
# Ensure empty categories still appear as placeholders
boss_guides_section["Boss & Slayer Guides"].append({category: folder})
logger.warning(f"⚠️ No guides found for '{category}', keeping as placeholder.")

# Add the Boss & Slayer Guides section to the nav
nav.append(boss_guides_section)

# For all other sections (excluding "Boss & Slayer Guides"), just add them to the nav
else:
nav.append(section)

def update_mkdocs_nav(self):
self.__nav.extend([{key: value} for key, value in self.__structure.items()])
# Rebuild the final nav structure, preserving the order defined in mkdocs.yml
self.__nav.clear()
self.__nav.extend(nav)
logger.debug(f"✅ Final Navigation Structure:\n{self.__nav}")
Loading