-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
96 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 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,78 @@ | ||
from django.contrib.sitemaps import Sitemap | ||
from django.urls import reverse | ||
|
||
from contributors.models import ( | ||
Contributor, | ||
Organization, | ||
Project, | ||
Repository, | ||
) | ||
|
||
|
||
class StaticViewSitemap(Sitemap): | ||
priority = 0.5 | ||
changefreq = 'weekly' | ||
|
||
def items(self): | ||
return [ | ||
'contributors:home', | ||
'contributors:about', | ||
'contributors:landing', | ||
'contributors:achievements' | ||
] | ||
|
||
def location(self, item): | ||
return reverse(item) | ||
|
||
|
||
class OrganizationSitemap(Sitemap): | ||
changefreq = "monthly" | ||
priority = 0.7 | ||
|
||
def items(self): | ||
return Organization.objects.all() | ||
|
||
def location(self, item): | ||
return reverse('contributors:organization_details', args=[item.name]) | ||
|
||
|
||
class RepositorySitemap(Sitemap): | ||
changefreq = "weekly" | ||
priority = 0.7 | ||
|
||
def items(self): | ||
return Repository.objects.all() | ||
|
||
def location(self, item): | ||
return reverse('contributors:repository_details', args=[item.name]) | ||
|
||
|
||
class ContributorSitemap(Sitemap): | ||
changefreq = "weekly" | ||
priority = 0.6 | ||
|
||
def items(self): | ||
return Contributor.objects.all() | ||
|
||
def location(self, item): | ||
return reverse('contributors:contributor_details', args=[item.login]) | ||
|
||
|
||
class ProjectSitemap(Sitemap): | ||
changefreq = "weekly" | ||
priority = 0.6 | ||
|
||
def items(self): | ||
return Project.objects.all() | ||
|
||
def location(self, item): | ||
return reverse('contributors:project_details', args=[item.pk]) | ||
|
||
|
||
sitemaps = { | ||
'static': StaticViewSitemap, | ||
'organizations': OrganizationSitemap, | ||
'repositories': RepositorySitemap, | ||
'contributors': ContributorSitemap, | ||
'projects': ProjectSitemap, | ||
} |
This file contains 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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
User-agent: * | ||
Allow: /repositories/$ | ||
Allow: /issues/$ | ||
Allow: /organizations/$ | ||
Allow: /leaderboard/$ | ||
Allow: /contributors/$ | ||
Allow: /projects/$ | ||
Disallow: /repositories/? | ||
Disallow: /issues/? | ||
Disallow: /organizations/? | ||
Disallow: /leaderboard/? | ||
Disallow: /contributors/? | ||
Disallow: /projects/? | ||
Disallow: /repositories/*? | ||
Disallow: /issues/*? | ||
Disallow: /organizations/*? | ||
Disallow: /leaderboard/*? | ||
Disallow: /contributors/*? | ||
Disallow: /projects/*? | ||
Disallow: /*page= | ||
Disallow: /*sort= | ||
Disallow: /*labels= | ||
Disallow: /admin/ | ||
Crawl-delay: 10 | ||
|
||
Sitemap: https://hexlet-friends.herokuapp.com/sitemap.xml |