Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
TO
Maják
Commits
60bb9991
Commit
60bb9991
authored
2 years ago
by
Tomáš
Browse files
Options
Downloads
Patches
Plain Diff
[ADD] wip - RSS feed for the main page
parent
4d3a0b99
No related branches found
No related tags found
2 merge requests
!690
Release
,
!689
Add RSS feed to main website
Pipeline
#10938
passed
2 years ago
Stage: build
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
main/feeds.py
+58
-0
58 additions, 0 deletions
main/feeds.py
main/templates/main/blocks/card_link_block.html
+1
-1
1 addition, 1 deletion
main/templates/main/blocks/card_link_block.html
main/templates/main/feed_item_description.html
+3
-0
3 additions, 0 deletions
main/templates/main/feed_item_description.html
with
62 additions
and
1 deletion
main/feeds.py
0 → 100644
+
58
−
0
View file @
60bb9991
from
django.contrib.syndication.views
import
Feed
from
django.shortcuts
import
render
from
django.urls
import
reverse
from
main.models
import
MainArticlesPage
,
MainArticlePage
class
LatestArticlesFeed
(
Feed
):
def
get_object
(
self
:
LatestArticlesFeed
,
request
,
title
:
str
)
->
MainArticlesPage
:
return
MainArticlesPage
.
objects
.
get
(
title
=
title
)
def
title
(
self
:
LatestArticlesFeed
,
obj
:
MainArticlesPage
)
->
str
:
return
obj
.
title
def
link
(
self
:
LatestArticlesFeed
,
obj
:
MainArticlesPage
)
->
str
:
return
obj
.
get_full_url
()
def
description
(
self
:
LatestArticlesFeed
,
obj
:
MainArticlesPage
)
->
str
:
return
obj
.
perex
def
items
(
self
:
LatestArticlesFeed
,
obj
:
MainArticlesPage
)
->
list
:
return
obj
.
get_children
().
type
(
MainArticlePage
)[:
32
]
def
item_title
(
self
:
LatestArticlesFeed
,
obj
:
MainArticlePage
)
->
str
:
return
obj
.
title
def
item_description
(
self
:
LatestArticlesFeed
,
item
:
MainArticlePage
):
return
render
(
None
,
"
main/feed_item_description.html
"
,
{
"
item
"
:
item
},
)
def
item_link
(
self
:
LatestArticlesFeed
,
item
:
MainArticlePage
)
->
str
:
return
item
.
get_full_url
()
This diff is collapsed.
Click to expand it.
main/templates/main/blocks/card_link_block.html
+
1
−
1
View file @
60bb9991
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<a
href=
"{{ target_url }}"
>
<a
href=
"{{ target_url }}"
>
{{ self.title }}
{{ self.title }}
</a>
</a>
</h
1
>
</h
2
>
<div
class=
"font-light text-sm break-words"
>
<div
class=
"font-light text-sm break-words"
>
{{ self.text | default_if_none:'' | richtext }}
{{ self.text | default_if_none:'' | richtext }}
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
main/templates/main/feed_item_description.html
0 → 100644
+
3
−
0
View file @
60bb9991
{% for block in item.content %}
{% include_block block %}
{% endfor %}
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