-
Notifications
You must be signed in to change notification settings - Fork 4
TWE-689: HTML Sitemap #428
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
05b3473
Sitemap feature implementation
baaa98f
Re-lint
5b6c124
another re-lint
5168102
Hopefully final re-lint
53a9117
Another attempt to fix stylelint vs prettier conflict
ce919af
Prettier fix
12d6cbb
Tweak to test logic
40daf19
Add pattern library yaml
2bea53a
Correct page/molecule structure
0b42d06
Changes from Frontend Review, feedback
d28f47d
Cleverer link insertion
3119111
Clean up queryset and add comment
9c5dc30
Slightly cleaner .live() versus a .filter()
damwaingames 3a5ff39
Rewrite the bucketing to use Treebeard path slicing O(1) vs O(n x m)
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,4 @@ node_modules* | |
| /.vscode/* | ||
| !/.vscode/launch.json | ||
| /database_dumps/ | ||
| .planning/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tbx/project_styleguide/templates/patterns/molecules/sitemap/sitemap_tree.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| {% load wagtailcore_tags %} | ||
|
damwaingames marked this conversation as resolved.
|
||
| <ul class="sitemap__links"> | ||
| {% for item in items %} | ||
| <li class="sitemap__link-item"> | ||
| <a href="{% pageurl item.page %}" class="sitemap__link">{{ item.page.title }}</a> | ||
| {% if item.children %} | ||
| {% include "patterns/molecules/sitemap/sitemap_tree.html" with items=item.children %} | ||
| {% endif %} | ||
| </li> | ||
| {% endfor %} | ||
| </ul> | ||
19 changes: 19 additions & 0 deletions
19
tbx/project_styleguide/templates/patterns/molecules/sitemap/sitemap_tree.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| context: | ||
| items: | ||
| - page: | ||
| title: Our Work | ||
| children: | ||
| - page: | ||
| title: Case Study One | ||
| children: [] | ||
| - page: | ||
| title: Case Study Two | ||
| children: [] | ||
| - page: | ||
| title: Strategy & Design | ||
| children: [] | ||
|
|
||
| tags: | ||
| pageurl: | ||
| item.page: | ||
| raw: '#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tbx/project_styleguide/templates/patterns/pages/sitemap/sitemap_page.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| {# tbx/project_styleguide/templates/patterns/pages/sitemap/sitemap_page.html #} | ||
| {% extends "patterns/base_page.html" %} | ||
| {% load wagtailcore_tags %} | ||
|
|
||
| {% block content %} | ||
| <div class="grid grid--spacer-large"> | ||
| <div class="grid__title"> | ||
| <h1 class="heading heading--three">{{ page.title }}</h1> | ||
| </div> | ||
| <div class="sitemap grid__sitemap"> | ||
| {% for item in sections %} | ||
| <section class="sitemap__section"> | ||
|
damwaingames marked this conversation as resolved.
|
||
| <h2 class="heading heading--four sitemap__section-heading"> | ||
|
helenb marked this conversation as resolved.
|
||
| <a href="{% pageurl item.section %}" class="sitemap__link">{{ item.section.title }}</a> | ||
| </h2> | ||
| {% if item.pages %} | ||
| {% include "patterns/molecules/sitemap/sitemap_tree.html" with items=item.pages %} | ||
| {% endif %} | ||
| </section> | ||
| {% endfor %} | ||
| </div> | ||
| </div> | ||
| {% endblock %} | ||
46 changes: 46 additions & 0 deletions
46
tbx/project_styleguide/templates/patterns/pages/sitemap/sitemap_page.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| context: | ||
| page: | ||
| title: Sitemap | ||
| get_verbose_name: sitemap page | ||
|
|
||
| sections: | ||
| - section: | ||
| title: Work | ||
| pages: | ||
| - page: | ||
| title: Our Work | ||
| children: | ||
| - page: | ||
| title: Case Study One | ||
| children: [] | ||
| - page: | ||
| title: Case Study Two | ||
| children: [] | ||
| - page: | ||
| title: Strategy & Design | ||
| children: [] | ||
| - section: | ||
| title: Charity | ||
| pages: | ||
| - page: | ||
| title: Digital for charities | ||
| children: [] | ||
| - page: | ||
| title: Fundraising technology | ||
| children: [] | ||
| - section: | ||
| title: Blog | ||
| pages: | ||
| - page: | ||
| title: All Posts | ||
| children: [] | ||
|
|
||
| tags: | ||
| pageurl: | ||
| item.section: | ||
| raw: '#' | ||
| item.page: | ||
| raw: '#' | ||
| footerlinks: | ||
| '': | ||
| template_name: 'patterns/navigation/components/footer-links.html' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class SitemapConfig(AppConfig): | ||
| default_auto_field = "django.db.models.AutoField" | ||
| name = "tbx.sitemap" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import wagtail_factories | ||
|
|
||
| from tbx.sitemap.models import SitemapPage | ||
|
|
||
|
|
||
| class SitemapPageFactory(wagtail_factories.PageFactory): | ||
| title = "Sitemap" | ||
|
|
||
| class Meta: | ||
| model = SitemapPage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Generated by Django 5.2.2 on 2026-04-20 14:58 | ||
|
|
||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| initial = True | ||
|
|
||
| dependencies = [ | ||
| ("divisions", "0003_remove_divisionpage_label_divisionpage_logo"), | ||
| ("images", "0002_customimage_description"), | ||
| ("navigation", "0008_navigationsettings_footer_newsletter_cta"), | ||
| ("people", "0012_divisionmixin_and_navigationsetmixin"), | ||
| ("wagtailcore", "0096_referenceindex_referenceindex_source_object_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name="SitemapPage", | ||
| fields=[ | ||
| ( | ||
| "page_ptr", | ||
| models.OneToOneField( | ||
| auto_created=True, | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| parent_link=True, | ||
| primary_key=True, | ||
| serialize=False, | ||
| to="wagtailcore.page", | ||
| ), | ||
| ), | ||
| ( | ||
| "navigation_text", | ||
| models.CharField( | ||
| blank=True, | ||
| help_text="\n Text entered here will appear instead of the page title in the navigation menu.\n For top-level menu items do this in the navigaiton settings instead.\n ", | ||
| max_length=255, | ||
| ), | ||
| ), | ||
| ("social_text", models.CharField(blank=True, max_length=255)), | ||
| ( | ||
| "theme", | ||
| models.CharField( | ||
| blank=True, | ||
| choices=[ | ||
| ("", "None"), | ||
| ("theme-coral", "Coral"), | ||
| ("theme-nebuline", "Nebuline"), | ||
| ("theme-lagoon", "Lagoon"), | ||
| ("theme-green", "Green"), | ||
| ], | ||
| max_length=25, | ||
| ), | ||
| ), | ||
| ( | ||
| "contact", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| help_text="The contact will be applied to this page's footer and all of its descendants.\nIf no contact is selected, it will be derived from this page's ancestors, eventually falling back to the default contact.", | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name="+", | ||
| to="people.contact", | ||
| ), | ||
| ), | ||
| ( | ||
| "division", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| to="divisions.divisionpage", | ||
| ), | ||
| ), | ||
| ( | ||
| "override_navigation_set", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name="+", | ||
| to="navigation.navigationset", | ||
| ), | ||
| ), | ||
| ( | ||
| "social_image", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name="+", | ||
| to="images.customimage", | ||
| ), | ||
| ), | ||
| ], | ||
| options={ | ||
| "verbose_name": "Sitemap page", | ||
| }, | ||
| bases=("wagtailcore.page", models.Model), | ||
| ), | ||
| ] |
Empty file.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.