mirror of https://gitlab.com/tildes/tildes.git
Browse Source
Add better control of content metadata by type
Add better control of content metadata by type
Previously, the content metadata displayed next to a topic's content type (like "Article: 1800 words") was fairly generic and could result in strange data being displayed if a scraper fetched it for an inappropriate type (for example, displaying word count for videos). This creates an enum to hold all the different content metadata fields, and moves some logic into that class to handle deciding which fields to show for different types, and the formatting logic for values.merge-requests/85/head
Deimos
5 years ago
4 changed files with 83 additions and 62 deletions
-
66tildes/tildes/enums.py
-
13tildes/tildes/lib/link_metadata.py
-
47tildes/tildes/models/topic/topic.py
-
19tildes/tildes/views/api/web/topic.py
@ -1,13 +0,0 @@ |
|||||
# Copyright (c) 2019 Tildes contributors <code@tildes.net> |
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later |
|
||||
|
|
||||
"""Constants/classes/functions related to metadata generated from links.""" |
|
||||
|
|
||||
METADATA_KEYS = [ |
|
||||
"authors", |
|
||||
"description", |
|
||||
"duration", |
|
||||
"published", |
|
||||
"title", |
|
||||
"word_count", |
|
||||
] |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue