add diverse links and meta to head (#522)

This commit is contained in:
fdb-hiroshima 2019-04-09 15:33:34 +02:00 committed by GitHub
parent de296b633f
commit c19c094e0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 4 deletions

View File

@ -532,7 +532,7 @@ pub fn atom_feed(name: String, conn: DbConn) -> Option<Content<String>> {
.title(author.display_name.clone()) .title(author.display_name.clone())
.id(Instance::get_local(&*conn) .id(Instance::get_local(&*conn)
.unwrap() .unwrap()
.compute_box("~", &name, "atom.xml")) .compute_box("@", &name, "atom.xml"))
.entries( .entries(
Post::get_recents_for_author(&*conn, &author, 15) Post::get_recents_for_author(&*conn, &author, 15)
.ok()? .ok()?

View File

@ -13,6 +13,7 @@
<link rel="stylesheet" href="@uri!(plume_static_files: file = "css/feather.css", _build_id = CACHE_NAME)" /> <link rel="stylesheet" href="@uri!(plume_static_files: file = "css/feather.css", _build_id = CACHE_NAME)" />
<link rel="manifest" href="@uri!(instance::web_manifest)" /> <link rel="manifest" href="@uri!(instance::web_manifest)" />
<link rel="icon" type="image/png" href="@uri!(plume_static_files: file = CONFIG.logo.favicon.as_str(), _build_id = CACHE_NAME)"> <link rel="icon" type="image/png" href="@uri!(plume_static_files: file = CONFIG.logo.favicon.as_str(), _build_id = CACHE_NAME)">
<meta content='#282c37' name='theme-color'/>
@:head() @:head()
</head> </head>
<body> <body>

View File

@ -1,4 +1,5 @@
@use plume_models::blogs::Blog; @use plume_models::blogs::Blog;
@use plume_models::instance::Instance;
@use plume_models::posts::Post; @use plume_models::posts::Post;
@use plume_models::users::User; @use plume_models::users::User;
@use templates::{base, partials::post_card}; @use templates::{base, partials::post_card};
@ -7,7 +8,22 @@
@(ctx: BaseContext, blog: Blog, authors: &[User], page: i32, n_pages: i32, posts: Vec<Post>) @(ctx: BaseContext, blog: Blog, authors: &[User], page: i32, n_pages: i32, posts: Vec<Post>)
@:base(ctx, blog.title.clone(), {}, { @:base(ctx, blog.title.clone(), {
<meta content="profile" property="og:type" />
<meta content="120" property="og:image:width" />
<meta content="120" property="og:image:height" />
<meta content="summary" property="twitter:card" />
<meta content="'@Instance::get_local(ctx.0).unwrap().name" property="og:site_name" />
<meta content="@blog.ap_url" property="og:url" />
<meta content="@blog.fqn" property="profile:username" />
<meta content="@blog.title" property="og:title" />
<meta content="@blog.summary_html" name="description">
<meta content="@blog.summary_html" property="og:description" />
<meta content="@blog.icon_url(ctx.0)" property="og:image" />r
<link href='@Instance::get_local(ctx.0).unwrap().compute_box("~", &blog.fqn, "atom.xml")' rel='alternate' type='application/atom+xml'>
<link href='@blog.ap_url' rel='alternate' type='application/activity+json'>
}, {
<a href="@uri!(blogs::details: name = &blog.fqn, page = _)">@blog.title</a> <a href="@uri!(blogs::details: name = &blog.fqn, page = _)">@blog.title</a>
}, { }, {
<div class="hidden"> <div class="hidden">

View File

@ -1,12 +1,28 @@
@use templates::{base, partials::post_card, users::header}; @use templates::{base, partials::post_card, users::header};
@use template_utils::*; @use template_utils::*;
@use plume_models::posts::Post; @use plume_models::instance::Instance;
@use plume_models::users::User; @use plume_models::users::User;
@use plume_models::posts::Post;
@use routes::*; @use routes::*;
@(ctx: BaseContext, user: User, follows: bool, is_remote: bool, remote_url: String, recents: Vec<Post>, reshares: Vec<Post>) @(ctx: BaseContext, user: User, follows: bool, is_remote: bool, remote_url: String, recents: Vec<Post>, reshares: Vec<Post>)
@:base(ctx, user.name(), {}, {}, { @:base(ctx, user.name(), {
<meta content="profile" property="og:type" />
<meta content="120" property="og:image:width" />
<meta content="120" property="og:image:height" />
<meta content="summary" property="twitter:card" />
<meta content="'@Instance::get_local(ctx.0).unwrap().name" property="og:site_name" />
<meta content="@user.ap_url" property="og:url" />
<meta content="@user.display_name" property="profile:username" />
<meta content="@user.display_name's Blog" property="og:title" />
<meta content="@user.summary_html" name="description">
<meta content="@user.summary_html" property="og:description" />
<meta content="@user.avatar_url(ctx.0)" property="og:image" />
<link href='@Instance::get_local(ctx.0).unwrap().compute_box("@", &user.fqn, "atom.xml")' rel='alternate' type='application/atom+xml'>
<link href='@user.ap_url' rel='alternate' type='application/activity+json'>
}, {}, {
@:header(ctx, &user, follows, is_remote, remote_url) @:header(ctx, &user, follows, is_remote, remote_url)
@tabs(&[ @tabs(&[