add sitemap and open graph
This commit is contained in:
parent
b836d38e70
commit
a07d1fc4e2
9 changed files with 176 additions and 0 deletions
62
hub/sitemaps.py
Normal file
62
hub/sitemaps.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
from django.contrib.sitemaps import Sitemap
|
||||
from django.urls import reverse
|
||||
from hub.services.models import (
|
||||
Service,
|
||||
CloudProvider,
|
||||
ConsultingPartner,
|
||||
ServiceOffering,
|
||||
)
|
||||
|
||||
|
||||
class StaticSitemap(Sitemap):
|
||||
changefreq = "monthly"
|
||||
priority = 1.0
|
||||
|
||||
def items(self):
|
||||
return ["services:homepage", "services:contact"]
|
||||
|
||||
def location(self, item):
|
||||
return reverse(item)
|
||||
|
||||
|
||||
class ServiceSitemap(Sitemap):
|
||||
changefreq = "weekly"
|
||||
priority = 1.0
|
||||
|
||||
def items(self):
|
||||
return Service.objects.filter(disable_listing=False).exclude(
|
||||
is_coming_soon=True
|
||||
)
|
||||
|
||||
def lastmod(self, obj):
|
||||
return obj.updated_at
|
||||
|
||||
|
||||
class OfferingSitemap(Sitemap):
|
||||
changefreq = "weekly"
|
||||
priority = 0.7
|
||||
|
||||
def items(self):
|
||||
return ServiceOffering.objects.filter(disable_listing=False)
|
||||
|
||||
def lastmod(self, obj):
|
||||
return obj.updated_at
|
||||
|
||||
|
||||
class CloudProviderSitemap(Sitemap):
|
||||
changefreq = "weekly"
|
||||
priority = 0.7
|
||||
|
||||
def items(self):
|
||||
return CloudProvider.objects.filter(disable_listing=False)
|
||||
|
||||
|
||||
class ConsultingPartnerSitemap(Sitemap):
|
||||
changefreq = "weekly"
|
||||
priority = 0.7
|
||||
|
||||
def items(self):
|
||||
return ConsultingPartner.objects.filter(disable_listing=False)
|
||||
|
||||
def lastmod(self, obj):
|
||||
return obj.updated_at
|
Loading…
Add table
Add a link
Reference in a new issue