Keep the publication an article's page declares
Readability already reads og:site_name and JSON-LD publisher.name; carry that through Page and Extracted and store it in articles.publication, the same way the page byline is kept. `publication_label` is what the readers will see after the feed name: the site name, else the domain, and nothing when it would only repeat the feed's own title. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YWmCpUojfHXhSZ2129Z7Nv
This commit is contained in:
+2
-10
@@ -6,7 +6,7 @@ use axum_login::tower_sessions::Session;
|
||||
use jiff::civil::Date;
|
||||
|
||||
use crate::server::AppState;
|
||||
use crate::types::{Issue, SocialSource};
|
||||
use crate::types::{Issue, SocialSource, domain};
|
||||
use crate::web::issue::{self, Download};
|
||||
use crate::web::session::{AuthSession, Viewer};
|
||||
use crate::web::{Html, Page, WebError};
|
||||
@@ -116,7 +116,7 @@ impl From<&Issue> for PublicIssue {
|
||||
url: article.canonical_url.clone(),
|
||||
author: article.author.clone(),
|
||||
source: article.feed_title.clone(),
|
||||
domain: domain(&article.canonical_url),
|
||||
domain: domain(&article.canonical_url).unwrap_or_default(),
|
||||
reading_minutes: article.reading_minutes(),
|
||||
word_count: article.word_count,
|
||||
summary: pick
|
||||
@@ -169,14 +169,6 @@ impl PublicIssue {
|
||||
}
|
||||
}
|
||||
|
||||
fn domain(raw: &str) -> String {
|
||||
url::Url::parse(raw)
|
||||
.ok()
|
||||
.and_then(|url| url.host_str().map(str::to_string))
|
||||
.map(|host| host.strip_prefix("www.").unwrap_or(&host).to_string())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "issue_public.html")]
|
||||
struct IssuePublicTemplate {
|
||||
|
||||
Reference in New Issue
Block a user