added sort posts list by date
This commit is contained in:
parent
2a9508e50b
commit
5e091128a0
2 changed files with 7 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
from datetime import date
|
||||
from zona.models import Item, ItemType
|
||||
from zona.metadata import parse_metadata
|
||||
from zona import markdown as zmd
|
||||
|
@ -71,7 +72,11 @@ class ZonaBuilder:
|
|||
|
||||
def _build(self):
|
||||
assert self.items
|
||||
post_list: list[Item] = [item for item in self.items if item.post]
|
||||
post_list: list[Item] = sorted(
|
||||
[item for item in self.items if item.post],
|
||||
key=lambda item: item.metadata.date if item.metadata else date.min,
|
||||
reverse=True,
|
||||
)
|
||||
templater = Templater(
|
||||
template_dir=self.layout.templates, post_list=post_list
|
||||
)
|
||||
|
|
|
@ -36,7 +36,7 @@ class BuildConfig:
|
|||
include_drafts: bool = False
|
||||
|
||||
|
||||
IGNORELIST = [".git", ".env", ".marksman.toml"]
|
||||
IGNORELIST = [".git", ".env", "*/.marksman.toml"]
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue