From 700e0cc136f50ade8eb4042d327968fd2052865d Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Fri, 19 Nov 2021 22:59:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96link=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/tags/link.js | 7 +++++-- source/css/_layout/tag-plugins/link.styl | 15 ++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/tags/link.js b/scripts/tags/link.js index 87812a8..3954c90 100644 --- a/scripts/tags/link.js +++ b/scripts/tags/link.js @@ -7,6 +7,9 @@ 'use strict'; +var util = require('hexo-util'); +const full_url_for = require('hexo-util').full_url_for.bind(hexo); + hexo.extend.tag.register('link', function(args) { args = hexo.args.map(args, ['icon'], ['url', 'title', 'description']); @@ -28,7 +31,7 @@ hexo.extend.tag.register('link', function(args) { return el; } function loadTitle() { - return '' + args.title + ''; + return '' + args.title + ''; } function loadDesc() { return '' + (args.description || args.url) + ''; @@ -38,7 +41,7 @@ hexo.extend.tag.register('link', function(args) { // top el += '
'; el += loadIcon(); - el += '' + args.url + ''; + el += '' + full_url_for(args.url) + ''; el += '
'; // bottom el += '
'; diff --git a/source/css/_layout/tag-plugins/link.styl b/source/css/_layout/tag-plugins/link.styl index eb0d639..d469ffc 100644 --- a/source/css/_layout/tag-plugins/link.styl +++ b/source/css/_layout/tag-plugins/link.styl @@ -26,13 +26,15 @@ .md .link-card.plain flex-direction: row + align-items: center .md .link-card.rich flex-direction: column - align-items: flex-start + align-items: stretch width: 400px .md .link-card + line-height: 1.2 > div pointer-events: none >.top @@ -51,11 +53,15 @@ background-position: left center .url opacity: .75 + line-height: 1.5 span txt-ellipsis() max-width: 100% >.bottom margin: 0 1rem .75rem 1rem + .title + font-size: $fs-15 + margin: 4px 0 8px 0 >.right width: 2.5rem height: 2.5rem @@ -65,6 +71,9 @@ >.left overflow: hidden margin: .5rem 0 .5rem 1rem + .title + font-size: $fs-14 + margin: 4px 0 .url flex-shrink: 0 txt-ellipsis() @@ -74,9 +83,5 @@ span.title font-weight: 500 color: var(--text-p1) - line-height: 1.2 - margin: 4px 0 span.url color: var(--text-p3) - line-height: 1.4 - margin: 2px 0