Add fix
This commit is contained in:
parent
d1c021f714
commit
8d6d3a38fd
|
@ -8,7 +8,7 @@ tags:
|
|||
- Website
|
||||
---
|
||||
|
||||
> ~~哪个男孩不想拥有一个贼快且使用 Cloudflare 的站点呢?~~
|
||||
> ~~哪个男孩不想拥有一个贼快且使用 的站点呢?~~
|
||||
|
||||
<!--more-->
|
||||
|
||||
|
@ -23,13 +23,13 @@ tags:
|
|||
>
|
||||
> 来自[维基百科](https://zh.wikipedia.org/wiki/HTTP/2)
|
||||
|
||||
`HTTP2` 相较于 `HTTP 1.1` 有许多特性 例如 `Server Push` `header压缩` `多路复用`
|
||||
`HTTP2` 相较于 `HTTP 1.1` 有许多特性,例如 `Server Push` `header压缩` `多路复用` 。
|
||||
|
||||
他们分别解决了 `HTTP 1.1` 的不同问题 尽可能提高了 `HTTP` 的性能
|
||||
他们分别解决了 `HTTP 1.1` 的不同问题,尽可能提高了 `HTTP` 的性能。
|
||||
|
||||
#### `Server Push`
|
||||
|
||||
服务器将会把页面中内连资源推送至客户端 跟随 `HTML文件` 发送至客户端 避免了解析 `DOM` 再请求的延时
|
||||
服务器将会把页面中内连资源推送至客户端,跟随 `HTML文件` 发送至客户端,避免了解析 `DOM` 再请求的延时。
|
||||
|
||||
需要注意的是,启用 `Server Push` 以后一定会存在流量浪费,因为服务端在接收到请求后一定会将额外的资源一并响应给客户端。如果客户端本地已有 `HTTP` 缓存,可以在接收到 `Push` 的帧后发送 `RST_STREAM` 帧阻止服务端发送后续的帧,但是头部的几个帧已经发送了,这是无可避免的。
|
||||
|
||||
|
@ -41,12 +41,12 @@ tags:
|
|||
|
||||
##### 如何启用 `Server Push`
|
||||
|
||||
1. 需要在 `Cloudflare` 面板启用 `HTTP2`
|
||||
1. 需要在 面板启用 `HTTP2`
|
||||
2. 在需要 `Server Push` 的 `HTML` 文件发送时新增 `header` : `Link`
|
||||
3. `Link` 需为 `HTML 5` 标准中 `<link rel="preload">` 的内容
|
||||
例如 `Link:</css/style.min.css>; rel=preload; as=style`
|
||||
|
||||
本站在使用 Cloudflare 作为 CDN 的情况下已启用 Server Push
|
||||
本站在使用 Cloudflare 作为 CDN 的情况下已启用 Server Push。
|
||||
|
||||
#### `Header压缩` & `多路复用`
|
||||
|
||||
|
@ -61,28 +61,50 @@ tags:
|
|||
|
||||
##### 如何启用
|
||||
|
||||
1. 在 `Cloudflare` 面板启用 `HTTP2`
|
||||
1. 在 面板启用 `HTTP2`
|
||||
2. Enjoy it
|
||||
|
||||
### 使用 `Cloudflare Partner` 来启用自选解析
|
||||
|
||||
使用 `Cloudflare Partner` 的自选解析可以有效的降低 `DNS` 请求用时,也可以对 `Cloudflare` 的 `Anycast` 网络进行部分自定义
|
||||
使用 `Cloudflare Partner` 的自选解析可以有效的降低 `DNS` 请求用时,也可以对 的 `Anycast` 网络进行部分自定义
|
||||
|
||||
文章引路-> [关于 Cloudflare 自选节点的一些个人见解 | Puresys](https://www.puresys.net/3116.html)
|
||||
|
||||
## 降低回源用时
|
||||
|
||||
但是,`Cloudflare` 中国大陆方向的网络质量是我们无法控制的,因此如果要缩短网站响应耗时、减少 `TTFB(首字节时间)` ,就只能在 `Cloudflare` 回源上做优化。
|
||||
但是, 中国大陆方向的网络质量是我们无法控制的,因此如果要缩短网站响应耗时、减少 `TTFB(首字节时间)` ,就只能在 回源上做优化。
|
||||
|
||||
### 使用缓存规则
|
||||
|
||||
### 启用 `brotli` 压缩
|
||||
`Clouflare` 为用户提供了完善的缓存配置功能,你可以通过 `Page Rules` 来详细的调整缓存规则
|
||||
|
||||
你可以在这里查询到有关 [`Caching`](https://support.cloudflare.com/hc/en-us/categories/200275248-Caching) 的内容
|
||||
|
||||
### 启用 [`brotli`](https://github.com/google/brotli) 压缩
|
||||
|
||||
> Brotli is a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling, with a compression ratio comparable to the best currently available general-purpose compression methods. It is similar in speed with deflate but offers more dense compression.
|
||||
>
|
||||
> -- 来自 [`google/brotil/README.md`](https://github.com/google/brotil)
|
||||
|
||||
`brotil` 是一个现代的压缩算法,已经被广泛用于网络的加速。相较于常用的 `gzip` 压缩算法 `brotil` 可以提高约10%-25%的压缩比。
|
||||
|
||||
你可以在 「 速度 - `Brotil` 」处应用 `Brotil` 加速。
|
||||
|
||||
### 将静态站点部署至 `Cloudflare Pages` or `Cloudflare Workers Sites`
|
||||
|
||||
PS: 鉴于 `Cloudflare Pages` 目前处于 `Beta Access` 阶段 请阅读 [Cloudflare Pages Docs](https://developers.cloudflare.com/pages) 详情
|
||||
|
||||
> `Cloudflare Worker` 提供了一个 `Serverless` 执行环境,使您无需配置或维护基础架构即可创建全新的应用程序或扩充现有的应用程序。
|
||||
>
|
||||
> --翻译自 [`Cloudflare Workers documentation/Welcome - Cloudflare Docs`](https://developers.cloudflare.com/workers/)
|
||||
|
||||
`Cloudflare Workers Sites` 是 `Cloudflare Workers` 的一个功能。将静态文件发布至 `KV Storage` [^KV_Storage] , `Workers` 从 `KV` 中取回数据并发送给客户端,来达到静态站点部署的效果。
|
||||
|
||||
你可以在 [Cloudflare Docs](https://developers.cloudflare.com/workers/platform/sites/start-from-existing) 获得详细的部署教程。
|
||||
|
||||
## 前端性能优化
|
||||
|
||||
### 降低请求大小 数量
|
||||
### 降低请求
|
||||
|
||||
#### 使用 `NoModule/Module` 构建
|
||||
|
||||
|
@ -100,11 +122,13 @@ tags:
|
|||
|
||||
#### 使用 `vanilla-lazyload`
|
||||
|
||||
### ~~PWA~~
|
||||
## 优化网络质量
|
||||
|
||||
## ~~备案 上带国内CDN的企业版~~
|
||||
### ~~备案 上带国内CDN的企业版~~
|
||||
|
||||
## 借物表
|
||||
|
||||
[天下武功,唯快不破 —— 我是这样优化博客的 | Sukka's Blog](https://blog.skk.moe/post/how-to-make-a-fast-blog/)
|
||||
[关于 Cloudflare 自选节点的一些个人见解 | Puresys](https://www.puresys.net/3116.html)
|
||||
|
||||
[^KV_Storage]:Cloudflare Workers KV是全球性的,低延迟的键值数据存储。
|
||||
|
|
|
@ -80,7 +80,7 @@ uiux:
|
|||
bg_color:
|
||||
|
||||
img:
|
||||
avatar: 'https://i.186526.xyz/avatar'
|
||||
avatar: 'https://186526.xyz/pic/avatar-round.webp'
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# Menu Settings
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<!-- ## Header ##-->
|
||||
<header>
|
||||
<h1 class="header-title text-center"> <img src="https://i.186526.xyz/avatar" alt="Avatar" style="border-radius:100%;width:150px;"><br><a href="<%= config.root %>"><%= config.title %></a></h1>
|
||||
<h1 class="header-title text-center"> <img src="https://186526.xyz/pic/avatar-round.webp" alt="Avatar" style="border-radius:100%;width:150px;"><br><a href="<%= config.root %>"><%= config.title %></a></h1>
|
||||
|
||||
<p class="text-center header-slogan">
|
||||
<% if (theme.uiux.slogan) { %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if (page.title) { %>
|
||||
<h1 class="card-title h3 mb-2"><%- page.title %></h1>
|
||||
<h1 class="card-title h3 mb-2 mt-2"><%- page.title %></h1>
|
||||
<% } %>
|
||||
|
||||
<%
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<title>404</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
||||
<link rel="shortcut icon" ref="https://i.186526.xyz/avatar">
|
||||
<link rel="shortcut icon" ref="https://186526.xyz/pic/avatar-round.webp">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<style>
|
||||
|
|
|
@ -2257,7 +2257,7 @@ summary.accordion-header::-webkit-details-marker {
|
|||
.card {
|
||||
background: #fff;
|
||||
border: .05rem solid #e7e9ed;
|
||||
border-radius: .1rem;
|
||||
border-radius: 0.5rem !important;
|
||||
display: flex;
|
||||
display: -ms-flexbox;
|
||||
-ms-flex-direction: column;
|
||||
|
|
|
@ -988,6 +988,114 @@
|
|||
src: url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Ubuntu';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/ubuntu/v15/4iCs6KVjbNBYlgoKcg72j00.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Ubuntu';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/ubuntu/v15/4iCs6KVjbNBYlgoKew72j00.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Ubuntu';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/ubuntu/v15/4iCs6KVjbNBYlgoKcw72j00.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Ubuntu';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/ubuntu/v15/4iCs6KVjbNBYlgoKfA72j00.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Ubuntu';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/ubuntu/v15/4iCs6KVjbNBYlgoKcQ72j00.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Ubuntu';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/ubuntu/v15/4iCs6KVjbNBYlgoKfw72.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/*
|
||||
* See: https://fonts.google.com/license/googlerestricted
|
||||
*/
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Google Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/googlesans/v27/4UaGrENHsxJlGDuGo1OIlL3Kwp5MKg.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Google Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/googlesans/v27/4UaGrENHsxJlGDuGo1OIlL3Nwp5MKg.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Google Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/googlesans/v27/4UaGrENHsxJlGDuGo1OIlL3Bwp5MKg.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Google Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/googlesans/v27/4UaGrENHsxJlGDuGo1OIlL3Awp5MKg.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Google Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(https://fonts.gstatic.com/s/googlesans/v27/4UaGrENHsxJlGDuGo1OIlL3Owp4.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
body{
|
||||
font-family: -apple-system, system-ui,'Roboto','Noto Sans SC',sans-serif !important;
|
||||
}
|
||||
.post-entry , #post-card .card-title{
|
||||
font-family: 'Ubuntu','Roboto','Noto Sans SC',sans-serif !important;
|
||||
}
|
||||
.header-title{
|
||||
font-family: 'Google Sans',-apple-system, system-ui,'Roboto','Noto Sans SC',sans-serif !important;
|
||||
}
|
|
@ -76,6 +76,9 @@
|
|||
background: #252d38 !important;
|
||||
border-color: #252d38 !important;
|
||||
}
|
||||
#post-toc {
|
||||
background: #252d38 !important;
|
||||
}
|
||||
#post-content blockquote {
|
||||
color: hsla(0, 0%, 100%, 0.86) !important;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ html .btn:focus {
|
|||
.card {
|
||||
/* Remove card border */
|
||||
border: none;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.timeline .timeline-item:last-child::before {
|
||||
|
@ -374,7 +375,7 @@ header .divider {
|
|||
box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14),
|
||||
0 1px 3px 0 rgba(0, 0, 0, 0.12);
|
||||
margin: 0.8rem 0;
|
||||
border-radius: 0;
|
||||
border-radius: 0.5rem;
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
word-wrap: break-word;
|
||||
|
@ -597,6 +598,7 @@ a.category-link {
|
|||
/* Post TOC */
|
||||
|
||||
#post-toc {
|
||||
display: none;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
max-width: 890px;
|
||||
|
@ -1038,6 +1040,7 @@ a.category-link {
|
|||
background-color: var(--post-footer);
|
||||
color: inherit;
|
||||
border-radius: 3px;
|
||||
padding: 0px 0.2rem;
|
||||
}
|
||||
|
||||
#post-content pre > code {
|
||||
|
|
Loading…
Reference in New Issue