Skip to content

Commit

Permalink
1.优化head、2.调整description在特殊情况下,只显示少部分内容的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Lete114 committed Jan 13, 2021
1 parent ddc91b5 commit 5657f8f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 71 deletions.
61 changes: 0 additions & 61 deletions ChangeLog.md

This file was deleted.

6 changes: 5 additions & 1 deletion layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
</div>
<div class="post-description">
<p style="-webkit-line-clamp: <%- theme.post_content.line %>">
<%- strip_html(post.content.substring(0, theme.post_content.length)) %>
<%
var content = strip_html(post.content)
content = strip_html(content.substring(0, theme.post_content.length))
%>
<%- content %>
</p>
</div>
<% if (theme.cover){ %>
Expand Down
34 changes: 26 additions & 8 deletions layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,44 @@ var title = theme.title || config.title
if(page.title!=null){
title = page.title + ' | '+title
}
var keywords = '';
if(page.tags!=null){
page.tags.forEach(function(tag, i){
keywords += tag.name+","
})
keywords = keywords.substring(0,keywords.length-1);
}else{
var keywords = theme.keywords || config.keywords
}
var description = page.description
if(description==null){
var content = strip_html(page.content)
description = content.substring(0, theme.post_content.length)
}
var url = config.url+"/"+page.path;
%>
<meta charset="utf-8">
<meta http-equiv="content-language" content="<%-theme.language || config.language%>">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<title><%- title %></title>
<link rel="icon" href="<%-theme.favicon%>">
<meta name="keywords" content="<%- page.keywords || theme.keywords || config.keywords %>">
<meta name="description" content="<%-theme.description || config.description%>" />
<meta name="keywords" content="<%- keywords || theme.keywords || config.keywords %>">
<meta name="description" content="<%- description || theme.description || config.description%>" />
<meta property="site_name" content="<%- theme.title || config.title %>" />
<meta property="og:type" content="website">
<meta property="og:url" content="<%-config.url%>">
<meta property="og:title" content="<%- theme.title || config.title %>" />
<meta property="og:url" content="<%- url || config.url%>">
<meta property="og:title" content="<%- title || theme.title || config.title %>" />
<meta property="og:site_name" content="<%- theme.title || config.title %>" />
<meta property="og:description" content="<%-theme.description || config.description%>" />
<meta property="og:description" content="<%- description || theme.description || config.description%>" />
<meta property="og:locale" content="<%-theme.language || config.language%>">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="<%- theme.title || config.title %>">
<meta name="twitter:description" content="<%-theme.description || config.description%>">
<link rel="dns-prefetch" href="<%-config.url%>">
<meta name="twitter:title" content="<%- title || theme.title || config.title %>">
<meta name="twitter:description" content="<%-description || theme.description || config.description%>">
<link rel="dns-prefetch" href="<%- url || config.url%>">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion layout/layout.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="<%-theme.language || config.language%>">
<head>
<%- partial('_partial/head') %>
<%- partial('_partial/import_head') %>
Expand Down

0 comments on commit 5657f8f

Please sign in to comment.