Change Content and Index to create pretty urls
This commit is contained in:
@@ -42,7 +42,7 @@ class Content(Output):
|
|||||||
def build_path(section: str, slug: str) -> Path:
|
def build_path(section: str, slug: str) -> Path:
|
||||||
if not Content._SECTION_RE.match(section):
|
if not Content._SECTION_RE.match(section):
|
||||||
raise ContentError(f"Invalid section '{section}'")
|
raise ContentError(f"Invalid section '{section}'")
|
||||||
path = Path(f"{section}/{slug}.html")
|
path = Path(f"{section}/{slug}/index.html")
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def read_body(self) -> str:
|
def read_body(self) -> str:
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Index(Output):
|
|||||||
if page_num == 1:
|
if page_num == 1:
|
||||||
file = Path("index.html")
|
file = Path("index.html")
|
||||||
else:
|
else:
|
||||||
file = Path(f"page-{page_num}.html")
|
file = Path(f"page-{page_num}/index.html")
|
||||||
|
|
||||||
if kind == "root":
|
if kind == "root":
|
||||||
path = file
|
path = file
|
||||||
|
|||||||
Reference in New Issue
Block a user