[ubuntu篇] 使用Github Pages 和hexo 建立个人博客,自定义域名,https加密,搜索引擎google,baidu,360收录 (2)

edit themes\next\_config.yml

local_search: enable: true # create a new 'Search' button next to 'Archives' # if auto, trigger search by changing input # if manual, trigger search by pressing enter key or search button trigger: auto # show top n results per article, show all results by setting to -1 top_n_per_article: 1 edit `_config.yml` search: path: search.xml field: post format: html limit: 10000 install_hexo_plugins.sh #!/bin/bash cnpm install hexo-deployer-git --save cnpm install hexo-generator-feed --save cnpm install hexo-generator-sitemap --save cnpm install hexo-generator-baidu-sitemap --save cnpm install hexo-generator-index --save cnpm install hexo-generator-archive --save cnpm install hexo-generator-category --save cnpm install hexo-generator-tag --save cnpm install hexo-generator-search --save cnpm install hexo-generator-searchdb --save Upload images to cnblog

install img-uploader chrome extension by here

upload image and get url.

use url in markdown.

![image here]() Multiple deploy

deploy to github.com: username.github.io

deploy to coding.net (gitcaffe): username

vim blog/_config.yml

deploy: type: git repo: github: git@github.com:<username>/<username>.github.io.git,master coding: git@git.coding.net:<username>/<username>.git,master Advanced custom domain and https

blog: Github pages

SSL:CloudFlare

domain: Godaddy (dns nameservers from CloudFlare)

get ips by

dig kezunlin.github.io +noall +answer

we get

185.199.108.153 185.199.109.153 185.199.110.153 185.199.111.153

A: point to 185.199.109.153

CNAME: point to kezunlin.me

steps:

get kezunlin.me from Godaddy.com

add kezunlin.me to github blog's blog\source\CNAME file

register CloudFlare.com and add A record with github page IP 185.199.109.153 and get dns nameservers dina.ns.cloudflare.com and paul.ns.cloudflare.com

add dns nameservers dina.ns.cloudflare.com and paul.ns.cloudflare.com from here

wait for some seconds and we get results from CloudFlare

kezunlin.me Status: Active This website is active on Cloudflare. Universal SSL Status Active Certificate

Active means nameservers take effect.

configure

Crypto | Always use HTTPS Page Rules| 2 rules for Always use HTTPS custom domain

register domin in godaddy: kezunlin.me

add kezunlin.me to dnspod and get dnspod nameservers.

visit https://dcc.godaddy.com/manage/kezunlin.me/dns#divDnsManagement to add dnspod nameservers.

f1g1ns1.dnspod.net f1g1ns2.dnspod.net

add CNAME records in dnspod

@ CNAME 207.97.227.245 # for github pages

vim blog/source/CNAME

kezunlin.me google analytics

get google-site-verification from google search console and add to themes/next/layout/_partials/head.swig

<meta content="***" />

get google_analytics and edit themes\next\_config.yml

google_analytics: UA-*** google structured-data

grep search for keywords

grep -r Organization . ./themes/next/layout/_macro/post.swig: <span hidden itemscope itemtype="http://schema.org/Organization">

add logo for publisher

edit themes\next\_config.yml and add

logo: /images/logo.png

edit ./themes/next/layout/_macro/post.swig

<span hidden itemscope itemtype="http://schema.org/Organization"> <meta content="{{ config.title }}"> <img src="{{ url_for( theme.logo ) }}" /> #<img src="http://www.likecs.com/images/logo.png" /> </span> baidu zhanzhang

get baidu-site-verification from https://ziyuan.baidu.com/ and add to themes/next/layout/_partials/head.swig

<meta content="***" /> 360 zhanzhang

get 360-site-verification from and add to themes/next/layout/_partials/head.swig

<meta content="***" /> gitment for comment

We can use github repo to store blog site's comments in issues

register OAuth Application

visit https://github.com/settings/applications/new

fill in blanks, callback URL: https://kezunlin.me

get client ID and client secret

gitment config

create a new repo named gitment in Github for storing comments in issues

edit blog\themes\next\_config.yml

gitment: enable: true mint: true # RECOMMEND, A mint on Gitment, to support count, language and proxy_gateway count: true # Show comments count in post meta area lazy: true # Comments lazy loading with a button cleanly: false # Hide 'Powered by ...' on footer, and more language: zh-Hans # Force language, or auto switch by theme github_user: kezunlin # MUST HAVE, Your Github ID github_repo: gitment # MUST HAVE, The repo you use to store Gitment comments client_id: <***> # MUST HAVE, Github client id for the Gitment client_secret: <***> # EITHER this or proxy_gateway, Github access secret token for the Gitment proxy_gateway: # Address of api proxy, See: https://github.com/aimingoo/intersect redirect_protocol: # Protocol of redirect_uri with force_redirect_protocol when mint enabled

Notice

github_user: kezunlin

github_repo: gitment

init page comment

hexo deploy to deploy blogs

visit page and click button Initialize Comment

post your first comment.

share jiathis

register jiathis and get uid

jiathis and baidushare do not support https

baidushare (RE)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwxdwx.html