Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page.name for ArchivePage is documented & used, but not available #50

Open
DonKult opened this issue Oct 16, 2020 · 3 comments
Open

page.name for ArchivePage is documented & used, but not available #50

DonKult opened this issue Oct 16, 2020 · 3 comments
Labels

Comments

@DonKult
Copy link
Contributor

DonKult commented Oct 16, 2020

In example/demo/content/tags.taxonomy the template title & description of the archive use page.name and the refdoc documents its existence, but it seems to have disappeared at some point (I am at least reasonably sure it existed last year).

Adding to ArchivePage in staticsite/features/syndication.py (I would have kinda expected it to be in taxonomy.py) a to_dict method "stolen" from the CategoryPage and self.name = self.created_from.to_dict().get("name") to the constructor solves this small problem, but I fully expect there to be a better/cleaner way.

Related: I see that lib/blog.html template uses page.created_from.…, so perhaps that should be used in the templates instead of page.name, but it isn't documented.

@spanezz spanezz added the bug label Aug 27, 2021
@spanezz
Copy link
Owner

spanezz commented Aug 27, 2021

I agree it's surprising that the tag archive is created by syndication.py. The general idea is that once there's a page that contains a collection of pages (in meta["pages"]), syndication can automatically add RSS/Atom feeds and archives

@spanezz
Copy link
Owner

spanezz commented Aug 27, 2021

I see that page.name exists for taxonomy pages only. In archive pages, using page.created_from.name would work, except that TaxonomyPage.__init__() helpfully sets template_title to something else, which seems to take priority.

Untangling this might need a refactoring of staticsite, introducing a clear division between populating the interconnected page structure and populating page metadata. Such a refactoring would be a good thing to do, not just for this issue

spanezz added a commit that referenced this issue Aug 27, 2021
spanezz added a commit that referenced this issue Aug 27, 2021
@spanezz
Copy link
Owner

spanezz commented Dec 16, 2022

Such a refactoring has now been done in the refactor branch 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants