-
Notifications
You must be signed in to change notification settings - Fork 0
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
Clément
committed
Jul 17, 2024
1 parent
1b67b84
commit d0ba4d6
Showing
7 changed files
with
59 additions
and
7 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
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,28 @@ | ||
from typing import Any | ||
from django.contrib.sitemaps import Sitemap | ||
from django.contrib.sites.models import Site | ||
from jssg.models import Page, Post | ||
from django.conf import settings | ||
|
||
class MySitemap(Sitemap) : | ||
def get_urls(self, site=None, **kwargs): | ||
site = Site(domain=settings.JFME_DOMAIN, name=settings.JFME_DOMAIN) | ||
return super(MySitemap, self).get_urls(site=site, **kwargs) | ||
|
||
class PageSitemap(MySitemap) : | ||
def items(self) : | ||
return list(Page.load_glob(all = True)) | ||
def location(self, page) -> str: | ||
if page.rel_folder_path != '' : | ||
return "/" + page.rel_folder_path + "/" + page.slug + ".html" | ||
else : | ||
return "/" + page.slug + ".html" | ||
|
||
class PostSitemap(MySitemap) : | ||
def items(self) : | ||
return list(Post.load_glob(all = True)) | ||
def location(self, page) -> str: | ||
if page.rel_folder_path != '' : | ||
return "/posts/article/" + page.rel_folder_path + "/" + page.slug + ".html" | ||
else : | ||
return "posts/articles/" + page.slug + ".html" |
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