搭建我的博客

註冊GitHub帳號

地址:https://github.com/javascript

建立博客

根據:用靜態頁面生成靜態博客css

個性化博客

作本身的simple:

根據:About Simplehtml

先fork,push到你fork以後的你的simple項目下,而後把src文件夾push到gh-pages分支java

The template files are at /src/template, so you can modify the template files and css files. If you want use your own theme you can clone the project, modify the template files and push the entire src folder in your gh-pages branch which will allow you generate your own static blog.

更名稱:

You can use your own blog name, just modify the main.json file, and change name="username".

設置disqus:

You can use disqus comment system, just modify the main.json file, and change disqus_shortname="" to disqus_shortname="your_shortname".

實測要改爲disqus_shortname="Login"才能加載git

登陸disqus: https://disqus.com/
在設置中的Website中填入博客地址github

添加多說評論系統:

登陸多說評論系統:http://duoshuo.com/

可知,在頁面中加入如下代碼便可:json

<!-- 多說評論框 start -->
    <div class="ds-thread" data-thread-key="ID" data-title="請替換成文章的標題" data-url="請替換成文章的網址"></div>
<!-- 多說評論框 end -->
<!-- 多說公共JS代碼 start (一個網頁只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"yhcao"};
    (function() {
        var ds = document.createElement('script');
        ds.type = 'text/javascript';ds.async = true;
        ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
        ds.charset = 'UTF-8';
        (document.getElementsByTagName('head')[0] 
         || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
    </script>
<!-- 多說公共JS代碼 end -->

修改本身simple項目的模版post.html

<div class="entry" id="main">

後添加:swift

<div class="duoshuo-div" id="duoshuo-div">
<!-- 多說評論框 start 
<div class="ds-thread" Id="data-duoshuo" data-thread-key="ID" data-title="標題" data-url="http://caojingyou.github.io"></div> -->
<!-- 多說評論框 end -->
<!-- 多說公共JS代碼 start (一個網頁只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"yhcao"};
    (function() {
        var ds = document.createElement('script');
        ds.type = 'text/javascript';ds.async = true;
        ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
        ds.charset = 'UTF-8';
        (document.getElementsByTagName('head')[0] 
         || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
    </script>
<!-- 多說公共JS代碼 end -->
</div>

<script id="pagesTemplate" type="text/mustache">

後添加:hexo

<script id="duoshuo-sc" type="text/mustache">
<div class="ds-thread" Id="data-duoshuo" data-thread-key="{{key}}" data-title="{{title}}" data-url="博客網址{{url}}"></div>
</script>

$("#main").prepend(contentHtml);

後添加:app

var duoshuoTemplate = Hogan.compile($("#duoshuo-sc").html());
var duoshuoHtml = duoshuoTemplate.render({"key": path, "title": post.title, "url": path});
$("#duoshuo-div").prepend(duoshuoHtml);

添加百度站內搜索:

進入百度站長平臺
按照百度站內搜索所講進行操做便可

添加swiftype站內搜索:

在github中百度站內搜索不識別,全部添加了swiftype而放棄百度。
網站地址:https://swiftype.com/

參考文檔:

建立GitHub技術博客全攻略
用靜態頁面生成靜態博客
About Simple
Github空間在線寫文章和用Farbox,Droppages在Dropbox建博客網站
百度站內搜索
使用swiftype實現站內搜索
Sitemap.xml Support

相關文章
相關標籤/搜索