diff --git a/taiga/front/sitemaps/__init__.py b/taiga/front/sitemaps/__init__.py index 00f9f1d6..96a97c07 100644 --- a/taiga/front/sitemaps/__init__.py +++ b/taiga/front/sitemaps/__init__.py @@ -21,11 +21,8 @@ from collections import OrderedDict from .generics import GenericSitemap from .projects import ProjectsSitemap -from .projects import ProjectEpicsSitemap from .projects import ProjectBacklogsSitemap from .projects import ProjectKanbansSitemap -from .projects import ProjectIssuesSitemap -from .projects import ProjectTeamsSitemap from .epics import EpicsSitemap @@ -46,11 +43,8 @@ sitemaps = OrderedDict([ ("generics", GenericSitemap), ("projects", ProjectsSitemap), - ("project-epics-list", ProjectEpicsSitemap), ("project-backlogs", ProjectBacklogsSitemap), ("project-kanbans", ProjectKanbansSitemap), - ("project-issues-list", ProjectIssuesSitemap), - ("project-teams", ProjectTeamsSitemap), ("epics", EpicsSitemap), diff --git a/taiga/front/sitemaps/epics.py b/taiga/front/sitemaps/epics.py index ed7f055f..b7753345 100644 --- a/taiga/front/sitemaps/epics.py +++ b/taiga/front/sitemaps/epics.py @@ -18,6 +18,8 @@ from django.db.models import Q from django.apps import apps +from datetime import timedelta +from django.utils import timezone from taiga.front.templatetags.functions import resolve @@ -33,6 +35,9 @@ class EpicsSitemap(Sitemap): Q(project__is_private=True, project__anon_permissions__contains=["view_epics"])) + queryset = queryset.exclude(description="") + queryset = queryset.exclude(description__isnull=True) + # Exclude blocked projects queryset = queryset.filter(project__blocked_code__isnull=True) @@ -48,7 +53,9 @@ class EpicsSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "daily" + if (timezone.now() - obj.modified_date) > timedelta(days=90): + return "montly" + return "weekly" def priority(self, obj): - return 0.4 + return 0.5 diff --git a/taiga/front/sitemaps/issues.py b/taiga/front/sitemaps/issues.py index 6b784d3b..34a2f482 100644 --- a/taiga/front/sitemaps/issues.py +++ b/taiga/front/sitemaps/issues.py @@ -18,6 +18,8 @@ from django.db.models import Q from django.apps import apps +from datetime import timedelta +from django.utils import timezone from taiga.front.templatetags.functions import resolve @@ -48,7 +50,9 @@ class IssuesSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "daily" + if (timezone.now() - obj.modified_date) > timedelta(days=90): + return "montly" + return "weekly" def priority(self, obj): - return 0.6 + return 0.5 diff --git a/taiga/front/sitemaps/milestones.py b/taiga/front/sitemaps/milestones.py index ecaf7c75..f373e692 100644 --- a/taiga/front/sitemaps/milestones.py +++ b/taiga/front/sitemaps/milestones.py @@ -18,6 +18,8 @@ from django.db.models import Q from django.apps import apps +from datetime import timedelta +from django.utils import timezone from taiga.front.templatetags.functions import resolve @@ -35,6 +37,8 @@ class MilestonesSitemap(Sitemap): "view_us", "view_tasks"])) + queryset = queryset.exclude(name="") + # Exclude blocked projects queryset = queryset.filter(project__blocked_code__isnull=True) @@ -50,7 +54,9 @@ class MilestonesSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "daily" + if (timezone.now() - obj.modified_date) > timedelta(days=90): + return "montly" + return "weekly" def priority(self, obj): - return 0.6 + return 0.1 diff --git a/taiga/front/sitemaps/projects.py b/taiga/front/sitemaps/projects.py index aa91bd3b..42e5dbfb 100644 --- a/taiga/front/sitemaps/projects.py +++ b/taiga/front/sitemaps/projects.py @@ -20,6 +20,8 @@ from django.db.models import Q from django.apps import apps from taiga.front.templatetags.functions import resolve +from datetime import timedelta +from django.utils import timezone from .base import Sitemap @@ -35,6 +37,9 @@ class ProjectsSitemap(Sitemap): # Exclude blocked projects queryset = queryset.filter(blocked_code__isnull=True) + queryset = queryset.exclude(description="") + queryset = queryset.exclude(description__isnull=True) + queryset = queryset.exclude(total_activity__gt=5) return queryset @@ -45,38 +50,12 @@ class ProjectsSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "hourly" - - def priority(self, obj): - return 0.9 - - -class ProjectEpicsSitemap(Sitemap): - def items(self): - project_model = apps.get_model("projects", "Project") - - # Get public projects OR private projects if anon user can view them and epics - queryset = project_model.objects.filter(Q(is_private=False) | - Q(is_private=True, - anon_permissions__contains=["view_project", - "view_epics"])) - - # Exclude projects without epics enabled - queryset = queryset.exclude(is_epics_activated=False) - - return queryset - - def location(self, obj): - return resolve("epics", obj.slug) - - def lastmod(self, obj): - return obj.modified_date - - def changefreq(self, obj): + if (timezone.now() - obj.modified_date) > timedelta(days=30): + return "montly" return "daily" def priority(self, obj): - return 0.6 + return 0.8 class ProjectBacklogsSitemap(Sitemap): @@ -89,6 +68,10 @@ class ProjectBacklogsSitemap(Sitemap): anon_permissions__contains=["view_project", "view_us"])) + queryset = queryset.exclude(description="") + queryset = queryset.exclude(description__isnull=True) + queryset = queryset.exclude(total_activity__gt=5) + # Exclude projects without backlog enabled queryset = queryset.exclude(is_backlog_activated=False) @@ -101,10 +84,12 @@ class ProjectBacklogsSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "daily" + if (timezone.now() - obj.modified_date) > timedelta(days=90): + return "montly" + return "weekly" def priority(self, obj): - return 0.6 + return 0.1 class ProjectKanbansSitemap(Sitemap): @@ -117,6 +102,10 @@ class ProjectKanbansSitemap(Sitemap): anon_permissions__contains=["view_project", "view_us"])) + queryset = queryset.exclude(description="") + queryset = queryset.exclude(description__isnull=True) + queryset = queryset.exclude(total_activity__gt=5) + # Exclude projects without kanban enabled queryset = queryset.exclude(is_kanban_activated=False) @@ -129,59 +118,9 @@ class ProjectKanbansSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "daily" + if (timezone.now() - obj.modified_date) > timedelta(days=90): + return "montly" + return "weekly" def priority(self, obj): - return 0.6 - - -class ProjectIssuesSitemap(Sitemap): - def items(self): - project_model = apps.get_model("projects", "Project") - - # Get public projects OR private projects if anon user can view them and issues - queryset = project_model.objects.filter(Q(is_private=False) | - Q(is_private=True, - anon_permissions__contains=["view_project", - "view_issues"])) - - # Exclude projects without issues enabled - queryset = queryset.exclude(is_issues_activated=False) - - return queryset - - def location(self, obj): - return resolve("issues", obj.slug) - - def lastmod(self, obj): - return obj.modified_date - - def changefreq(self, obj): - return "daily" - - def priority(self, obj): - return 0.6 - - -class ProjectTeamsSitemap(Sitemap): - def items(self): - project_model = apps.get_model("projects", "Project") - - # Get public projects OR private projects if anon user can view them - queryset = project_model.objects.filter(Q(is_private=False) | - Q(is_private=True, - anon_permissions__contains=["view_project"])) - - return queryset - - def location(self, obj): - return resolve("team", obj.slug) - - def lastmod(self, obj): - return obj.modified_date - - def changefreq(self, obj): - return "daily" - - def priority(self, obj): - return 0.6 + return 0.1 diff --git a/taiga/front/sitemaps/tasks.py b/taiga/front/sitemaps/tasks.py index b9314ba5..d7faf410 100644 --- a/taiga/front/sitemaps/tasks.py +++ b/taiga/front/sitemaps/tasks.py @@ -18,6 +18,8 @@ from django.db.models import Q from django.apps import apps +from datetime import timedelta +from django.utils import timezone from taiga.front.templatetags.functions import resolve @@ -48,7 +50,9 @@ class TasksSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "daily" + if (timezone.now() - obj.modified_date) > timedelta(days=90): + return "montly" + return "weekly" def priority(self, obj): - return 0.4 + return 0.5 diff --git a/taiga/front/sitemaps/users.py b/taiga/front/sitemaps/users.py index d515276f..b2d9a1b1 100644 --- a/taiga/front/sitemaps/users.py +++ b/taiga/front/sitemaps/users.py @@ -41,7 +41,7 @@ class UsersSitemap(Sitemap): return None def changefreq(self, obj): - return "daily" + return "weekly" def priority(self, obj): - return 0.6 + return 0.5 diff --git a/taiga/front/sitemaps/userstories.py b/taiga/front/sitemaps/userstories.py index 1a5e36ee..e7a80216 100644 --- a/taiga/front/sitemaps/userstories.py +++ b/taiga/front/sitemaps/userstories.py @@ -18,6 +18,8 @@ from django.db.models import Q from django.apps import apps +from datetime import timedelta +from django.utils import timezone from taiga.front.templatetags.functions import resolve @@ -48,7 +50,9 @@ class UserStoriesSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "daily" + if (timezone.now() - obj.modified_date) > timedelta(days=90): + return "montly" + return "weekly" def priority(self, obj): - return 0.6 + return 0.5 diff --git a/taiga/front/sitemaps/wiki.py b/taiga/front/sitemaps/wiki.py index e6ccd4a1..790d102a 100644 --- a/taiga/front/sitemaps/wiki.py +++ b/taiga/front/sitemaps/wiki.py @@ -18,6 +18,8 @@ from django.db.models import Q from django.apps import apps +from datetime import timedelta +from django.utils import timezone from taiga.front.templatetags.functions import resolve @@ -51,7 +53,9 @@ class WikiPagesSitemap(Sitemap): return obj.modified_date def changefreq(self, obj): - return "daily" + if (timezone.now() - obj.modified_date) > timedelta(days=90): + return "montly" + return "weekly" def priority(self, obj): return 0.6