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
2354a751
Commit
2354a751
authored
2 years ago
by
Tomáš
Browse files
Options
Downloads
Patches
Plain Diff
improve RSS feed - enclosures, RSS-specific blocks
parent
f5b68219
No related branches found
No related tags found
2 merge requests
!704
Release
,
!703
Improve RSS feeds
Pipeline
#11299
passed
2 years ago
Stage: build
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
main/blocks.py
+1
-0
1 addition, 0 deletions
main/blocks.py
main/feeds.py
+19
-0
19 additions, 0 deletions
main/feeds.py
main/templates/main/feed_item_description.html
+20
-1
20 additions, 1 deletion
main/templates/main/feed_item_description.html
with
40 additions
and
1 deletion
main/blocks.py
+
1
−
0
View file @
2354a751
from
django.utils.text
import
slugify
from
django.template.loader
import
render_to_string
from
wagtail.core.blocks
import
(
CharBlock
,
ListBlock
,
...
...
This diff is collapsed.
Click to expand it.
main/feeds.py
+
19
−
0
View file @
2354a751
import
typing
from
datetime
import
datetime
from
django.contrib.syndication.views
import
Feed
...
...
@@ -92,3 +94,20 @@ class LatestArticlesFeed(Feed):
item
:
MainArticlePage
)
->
str
:
return
item
.
get_full_url
()
def
item_enclosure_url
(
self
,
item
:
MainArticlePage
)
->
typing
.
Union
[
None
,
str
]:
if
item
.
image
is
None
:
return
None
return
item
.
image
.
get_rendition
(
"
format-webp
"
).
full_url
item_enclosure_mime_type
=
"
image/webp
"
def
item_enclosure_length
(
self
,
item
:
MainArticlePage
)
->
int
:
return
item
.
image
.
file_size
This diff is collapsed.
Click to expand it.
main/templates/main/feed_item_description.html
+
20
−
1
View file @
2354a751
{% load wagtailcore_tags %}
<p>
{{ item.perex }}
</p>
{% for block in item.content %}
{% include_block block %}
{% if block.block_type == "text" %}
{% comment %}
No need to wrap this in a
<p>
, as the value already does this
{% endcomment %}
{{ block.value }}
{% elif block.block_type == "quote" %}
<blockquote>
„{{ block.value.quote }}“
</blockquote>
<p>
— {{ block.value.autor_name }}
</p>
{% elif block.block_type == "download" %}
<p>
Soubor „{{ block.value.file }}“ ke stažení:
<a
href=
"{{ block.value.file.url }}"
>
{{ block.value.file.url }}
</a>
</p>
{% elif block.block_type == "image" %}
<a
href=
"{{ block.value.href }}"
>
<img
src=
"{{ block.value.image.url }}"
>
</a>
<p>
{{ block.value.text }}
</p>
{% endif %}
{% 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