Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
site-kwei
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mediatek
site-kwei
Commits
97746495
Commit
97746495
authored
4 years ago
by
Dorian Lesbre
Browse files
Options
Downloads
Patches
Plain Diff
Added sitemap
parent
a4cb9737
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
home/urls.py
+7
-0
7 additions, 0 deletions
home/urls.py
home/views.py
+19
-0
19 additions, 0 deletions
home/views.py
interludes/settings.py
+2
-1
2 additions, 1 deletion
interludes/settings.py
with
28 additions
and
1 deletion
home/urls.py
+
7
−
0
View file @
97746495
from
django.contrib.sitemaps.views
import
sitemap
from
django.views.generic
import
RedirectView
from
django.urls
import
path
from
.
import
views
sitemaps
=
{
"
static_pages
"
:
views
.
StaticViewSitemap
}
urlpatterns
=
[
path
(
''
,
views
.
static_view
,
{
"
slug
"
:
"
home
"
},
name
=
'
home
'
),
path
(
'
inscription/
'
,
views
.
static_view
,
{
"
slug
"
:
"
inscription
"
},
name
=
'
inscription
'
),
path
(
'
activites/
'
,
views
.
static_view
,
{
"
slug
"
:
"
activites
"
},
name
=
'
activites
'
),
path
(
'
faq/
'
,
views
.
static_view
,
{
"
slug
"
:
"
faq
"
},
name
=
'
FAQ
'
),
path
(
'
favicon.ico
'
,
RedirectView
.
as_view
(
url
=
'
/static/imgs/favicon.ico
'
)),
path
(
'
sitemap.xml
'
,
sitemap
,
{
'
sitemaps
'
:
sitemaps
},
name
=
'
django.contrib.sitemaps.views.sitemap
'
),
]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
home/views.py
+
19
−
0
View file @
97746495
from
django.contrib.sitemaps
import
Sitemap
from
django.shortcuts
import
render
from
django.urls
import
reverse
def
static_view
(
request
,
slug
):
return
render
(
request
,
slug
+
'
.html
'
,
{
'
slug
'
:
slug
})
class
StaticViewSitemap
(
Sitemap
):
changefreq
=
'
monthly
'
def
items
(
self
):
return
[
"
home
"
,
"
inscription
"
,
"
activites
"
,
"
FAQ
"
]
def
location
(
self
,
item
):
return
reverse
(
item
)
def
priority
(
self
,
obj
):
# Priorize home page over the rest in search results
if
obj
==
"
home
"
or
obj
==
""
:
return
0.8
else
:
return
None
# defaults to 0.5 when unset
\ No newline at end of file
This diff is collapsed.
Click to expand it.
interludes/settings.py
+
2
−
1
View file @
97746495
...
...
@@ -37,7 +37,8 @@ INSTALLED_APPS = [
'
django.contrib.sessions
'
,
'
django.contrib.messages
'
,
'
django.contrib.staticfiles
'
,
'
home.apps.HomeConfig
'
'
django.contrib.sitemaps
'
,
'
home.apps.HomeConfig
'
,
]
MIDDLEWARE
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment