chore(*): add new article
parent
5b506f8877
commit
c32bf5a926
|
@ -3,21 +3,21 @@ version: 2.0.0
|
|||
# Path or URL to the website's icon
|
||||
favicon: /images/favicon.svg
|
||||
# Path or URL to RSS atom.xml
|
||||
rss:
|
||||
rss:
|
||||
# Path or URL to the website's logo to be shown on the left of the navigation bar or footer
|
||||
logo: /images/logo.svg
|
||||
# Open Graph metadata (https://hexo.io/docs/helpers.html#open-graph)
|
||||
open_graph:
|
||||
# Facebook App ID
|
||||
fb_app_id:
|
||||
fb_app_id:
|
||||
# Facebook Admin ID
|
||||
fb_admins:
|
||||
fb_admins:
|
||||
# Twitter ID
|
||||
twitter_id:
|
||||
twitter_id:
|
||||
# Twitter site
|
||||
twitter_site:
|
||||
twitter_site:
|
||||
# Google+ profile link
|
||||
google_plus:
|
||||
google_plus:
|
||||
# Navigation bar link settings
|
||||
navbar:
|
||||
# Navigation bar menu links
|
||||
|
@ -75,8 +75,8 @@ widgets:
|
|||
author: PPOffice
|
||||
author_title: Web Developer
|
||||
location: Earth, Solar System
|
||||
avatar:
|
||||
gravatar:
|
||||
avatar:
|
||||
gravatar:
|
||||
follow_link: 'http://github.com/ppoffice'
|
||||
social_links:
|
||||
Github:
|
||||
|
@ -136,9 +136,10 @@ plugins:
|
|||
# Baidu Analytics plugin settings (http://ppoffice.github.io/hexo-theme-icarus/2018/01/01/plugin/Analytics/#Baidu-Analytics)
|
||||
baidu-analytics:
|
||||
# Baidu Analytics tracking id
|
||||
tracking_id:
|
||||
tracking_id:
|
||||
hotjar:
|
||||
site_id: 1067642
|
||||
progressbar: true
|
||||
# CDN provider settings
|
||||
providers:
|
||||
# Name or URL of the JavaScript and/or stylesheet CDN provider
|
||||
|
@ -147,4 +148,3 @@ providers:
|
|||
fontcdn: google
|
||||
# Name or URL of the webfont Icon CDN provider
|
||||
iconcdn: fontawesome
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
title: Speed up Your Site with Custom CDN
|
||||
date: 2018-10-16
|
||||
toc: true
|
||||
categories:
|
||||
- Configuration
|
||||
- Theme
|
||||
tags:
|
||||
- Advanced Topics
|
||||
---
|
||||
|
||||
Using a right CDN provider can speed up page loading process of your viewers. Icarus allows you to specify the CDN provider of third-party static libraries you want to use.
|
||||
|
||||
### Built-in CDN providers
|
||||
Currently, you can choose between these built-in providers:
|
||||
|
||||
- **General CDNs**
|
||||
- CDN.js (cdnjs)
|
||||
- jsDelivr (jsdelivr)
|
||||
- Unpkg (unpkg)
|
||||
- **Font CDNs**
|
||||
- Google Fonts (google)
|
||||
- **Icon Font CDNs**
|
||||
- Font Awesome (fontawesome)
|
||||
|
||||
<!-- more -->
|
||||
|
||||
The default CDN settings are:
|
||||
|
||||
```yml
|
||||
providers:
|
||||
cdn: jsdelivr
|
||||
fontcdn: google
|
||||
iconcdn: fontawesome
|
||||
```
|
||||
|
||||
### Custom CDN providers
|
||||
Additionally, you can also use custom CDN providers by putting their URLs in the configuration file. For **general CDNs**, you should provide a URL format string with the following format:
|
||||
|
||||
```
|
||||
https://some.cdn.domain.name/${package}/${version}/${filename}
|
||||
```
|
||||
|
||||
You need to replace the actual package name, version of the package and relative file path with `${package}`, `${version}`, and `${filename}` placeholders. For example, a JavaScript library with the following URL
|
||||
|
||||
```
|
||||
https://unpkg.com/d3@5.7.0/dist/d3.min.js
|
||||
```
|
||||
|
||||
can be generalized to this
|
||||
|
||||
```
|
||||
https://unpkg.com/${package}@${version}/${filename}
|
||||
```
|
||||
|
||||
You should know that CDN providers may adopt different URL schemes where the package name and file path for a library are not exactly the same. For example, the `moment.js` library has the URL like this on CDN.js:
|
||||
|
||||
```
|
||||
https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.js
|
||||
```
|
||||
|
||||
while has the following URL on Unpkg:
|
||||
|
||||
```
|
||||
https://unpkg.com/moment@2.22.2/min/moment.min.js
|
||||
```
|
||||
|
||||
Therefore, you should be aware of the URL format of your custom CDN provider. By default, Icarus will try to pass in the parameter just like they would be for an npm repository (e.g., `moment@2.22.2/min/moment.min.js`). This npm scheme is used by jsDelivr and Unpkg. Otherwise, if you are using a CDN.js like provider, please prepend `[cdnjs]` to its format string:
|
||||
|
||||
```
|
||||
[cdnjs]https://some.cdn.domain.name/${package}/${version}/${filename}
|
||||
```
|
||||
|
||||
For **font CDN**, you can pass in the URL of a Google Font mirror or compatible webfont CDN. Icarus depends on the `Ubuntu` and `Source Code Pro` fonts, so make sure your CDN provides those. The URL should have two placeholders for font type (`icon` or `font`) and font name:
|
||||
|
||||
```
|
||||
https://some.google.font.mirror/${type}?family=${fontname}
|
||||
```
|
||||
|
||||
For **icon CDN**, you can pass in the URL to a custom Font Awesome CDN. No placeholders are required. The provided custom CDN should at lease have Font Awesome 5 icons as some of them are used in this theme.
|
||||
|
||||
```
|
||||
https://custom.fontawesome.mirror/some.stylesheet.css
|
||||
```
|
||||
|
||||
All of the above should be put in the `provider` section of theme configuration file:
|
||||
|
||||
```yml
|
||||
providers:
|
||||
cdn: 'https://some.cdn.domain.name/${package}/${version}/${filename}'
|
||||
fontcdn: 'https://some.google.font.mirror/${type}?family=${fontname}'
|
||||
iconcdn: 'https://custom.fontawesome.mirror/some.stylesheet.css'
|
||||
```
|
||||
|
||||
### CDN helper functions
|
||||
Three helper functions have been defined to help developers include third-party libraries easily with custom CDN support. You can check them out in `includes/helpers/cdn.js` under the Icarus theme folder.
|
|
@ -3,7 +3,7 @@ date: 2017-01-30 10:15:01
|
|||
categories:
|
||||
- Translations
|
||||
comments: false
|
||||
thumbnail: /gallery/thumbnails/arabic-pyramid.jpg
|
||||
thumbnail: /gallery/thumbnails/mosque.jpg
|
||||
meta:
|
||||
- name="robots";content="noindex, follow"
|
||||
direction: rtl
|
||||
|
@ -27,3 +27,5 @@ direction: rtl
|
|||
كل فمرّ وانتهاءً حين. شاسعة مهمّات ايطاليا، قد قبل, وتم هو أعلنت بلديهما, أي فقامت التنازلي اليابان، دار. ثم ضمنها الإمتعاض بريطانيا-فرنسا على, قد حول وقرى استدعى. أوروبا ألمانيا ٣٠ يبق. عرض إذ احداث الصين. في بين ببعض ويكيبيديا،, وصل بسبب تحرير النفط بـ.
|
||||
|
||||
التي ضمنها به، إذ, دارت مشروط أي حول, فقد عن فقامت الأرضية ماليزيا،. تنفّس انتهت يونيو شيء إذ, أي عدم لليابان الدولارات. وإقامة الخاطفة والمانيا عن حول. بل جُل أكثر والإتحاد, تم ضرب انتباه والإتحاد. من قامت انتهت دنو.
|
||||
|
||||
<a style="background-color:black;color:white;text-decoration:none;padding:4px 6px;font-size:12px;line-height:1.2;display:inline-block;border-radius:3px" href="https://unsplash.com/@danfreemanphoto?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge" target="_blank" rel="noopener noreferrer" title="Download free do whatever you want high-resolution photos from Dan Freeman"><span style="display:inline-block;padding:2px 3px"><svg xmlns="http://www.w3.org/2000/svg" style="height:12px;width:auto;position:relative;vertical-align:middle;top:-1px;fill:white" viewBox="0 0 32 32"><title>unsplash-logo</title><path d="M20.8 18.1c0 2.7-2.2 4.8-4.8 4.8s-4.8-2.1-4.8-4.8c0-2.7 2.2-4.8 4.8-4.8 2.7.1 4.8 2.2 4.8 4.8zm11.2-7.4v14.9c0 2.3-1.9 4.3-4.3 4.3h-23.4c-2.4 0-4.3-1.9-4.3-4.3v-15c0-2.3 1.9-4.3 4.3-4.3h3.7l.8-2.3c.4-1.1 1.7-2 2.9-2h8.6c1.2 0 2.5.9 2.9 2l.8 2.4h3.7c2.4 0 4.3 1.9 4.3 4.3zm-8.6 7.5c0-4.1-3.3-7.5-7.5-7.5-4.1 0-7.5 3.4-7.5 7.5s3.3 7.5 7.5 7.5c4.2-.1 7.5-3.4 7.5-7.5z"></path></svg></span><span style="display:inline-block;padding:2px 3px">Dan Freeman</span></a>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 143 KiB |
Binary file not shown.
After Width: | Height: | Size: 650 KiB |
|
@ -1 +1 @@
|
|||
Subproject commit 37c0d69f08fc14c17325d815ef3f1b14ab533cc8
|
||||
Subproject commit 78f0eb9305128873c60532d6b034c3c63a1e9796
|
Loading…
Reference in New Issue