blob: 5d896e8dd94491d17ded2f69f51ca0a16e206474 [file] [log] [blame]
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="zh"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="zh"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="zh"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="zh"><!--<![endif]-->
<meta charset="utf-8">
<title>Theme Setup </title>
<meta name="description" content="Instructions on how to install and customize the modern Jekyll theme HPSTR.">
<!-- Open Graph -->
<meta property="og:locale" content="en_US">
<meta property="og:type" content="article">
<meta property="og:title" content="Theme Setup">
<meta property="og:description" content="Instructions on how to install and customize the modern Jekyll theme HPSTR.">
<meta property="og:url" content="">
<meta property="og:site_name" content="">
<link rel="canonical" href="">
<link href="" type="application/atom+xml" rel="alternate" title=" Feed">
<!-- -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- For all browsers -->
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<meta http-equiv="cleartype" content="on">
<!-- Load Modernizr -->
<script src=""></script>
<!-- Icons -->
<!-- 16x16 -->
<link rel="shortcut icon" href="">
<!-- 32x32 -->
<link rel="shortcut icon" href="">
<!-- 57x57 (precomposed) for iPhone 3GS, pre-2011 iPod Touch and older Android devices -->
<link rel="apple-touch-icon-precomposed" href="">
<!-- 72x72 (precomposed) for 1st generation iPad, iPad 2 and iPad mini -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="">
<!-- 114x114 (precomposed) for iPhone 4, 4S, 5 and post-2011 iPod Touch -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="">
<!-- 144x144 (precomposed) for iPad 3rd and 4th generation -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="">
<body id="page" class="feature">
<!--[if lt IE 9]><div class="upgrade"><strong><a href="">Your browser is quite old!</strong> Why not upgrade to a different browser to better enjoy this site?</a></div><![endif]-->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false" class="navbar-toggle collapsed">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<a href="" class="navbar-brand">
<img src="" alt="echarts logo" class="navbar-logo">
<div id="navbar-collapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li id="nav-index"><a href="">首页</a></li>
<li id="nav-doc" class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">文档<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="">特性</a></li>
<li><a href="">教程</a></li>
<li><a href="">API</a></li>
<li><a href="">配置项手册</a></li>
<li><a href="">常见问题</a></li>
<li><a href="">版本记录</a></li>
<li id="nav-download" class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">下载<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="">下载</a></li>
<li><a href="">主题下载</a></li>
<li><a href="">地图下载</a></li>
<li><a href="">扩展下载</a></li>
<li id="nav-examples">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">实例<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="">官方实例</a></li>
<li><a href="">GL 实例</a></li>
<li id="nav-community" class="active">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">社区<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="">GALLERY</a></li>
<li><a href="">博客</a></li>
<li id="nav-tool">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">工具<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="">表格工具</a></li>
<li><a href="">地图数据在线工具</a></li>
<li><a href="">主题构建工具</a></li>
<li id="nav-about"><a href="">关于</a></li>
<ul class="nav navbar-nav navbar-right">
<li id="nav-github"><a href="" target="_blank"><img src="" width="18"></a></li>
<li id="nav-2" class="0"><a href="">2.0</a></li>
<li id="nav-homeen"><a href="">EN</a></li>
<div class="entry-header">
<div class="image-credit">图片来源:<a href="">dargadgetz</a></div><!-- /.image-credit -->
<div class="entry-image">
<img src="" alt="Theme Setup">
</div><!-- /.entry-image -->
</div><!-- /.entry-header -->
<div id="main" role="main">
<article class="hentry">
<header class="header-title">
<div class="header-title-wrap">
<h1 class="entry-title">Theme Setup</h1>
</div><!-- /.header-title-wrap -->
<div class="entry-content">
<p>General notes and suggestions for customizing <strong>HPSTR</strong>.</p>
<p>HPSTR now requires <a href="">Jekyll</a> 3.0. Make sure to run <code class="highlighter-rouge">bundle update</code> if you aren’t on the latest version to update all gem dependencies.</p>
<h2 id="basic-setup-for-a-new-jekyll-site">Basic Setup for a new Jekyll site</h2>
<li><a href="">Install Bundler</a> <code class="highlighter-rouge">gem install bundler</code> and then install <a href="">Jekyll</a> and all dependencies <code class="highlighter-rouge">bundle install</code>.</li>
<li>Fork the <a href="">HPSTR Jekyll Theme repo</a>.</li>
<li>Clone the repo you just forked and rename it.</li>
<li>Edit <code class="highlighter-rouge">_config.yml</code> to personalize your site.</li>
<li>Check out the sample posts in <code class="highlighter-rouge">_posts</code> to see examples for pulling in large feature images, assigning categories and tags, and other YAML data.</li>
<li>Read the documentation below for further customization pointers and documentation.</li>
<div><a href="" class="btn">Download the Theme</a></div>
<p class="notice"><strong>Pro-tip:</strong> Delete the <code class="highlighter-rouge">gh-pages</code> branch after cloning and start fresh by branching off <code class="highlighter-rouge">master</code>. There is a bunch of garbage in <code class="highlighter-rouge">gh-pages</code> used for the theme’s demo site that I’m guessing you don’t want on your site.</p>
<hr />
<h2 id="setup-for-an-existing-jekyll-site">Setup for an Existing Jekyll site</h2>
<li>Clone the following folders: <code class="highlighter-rouge">_includes</code>, <code class="highlighter-rouge">_layouts</code>, <code class="highlighter-rouge">_sass</code>, <code class="highlighter-rouge">assets</code>, and <code class="highlighter-rouge">images</code>.</li>
<li>Clone the following folders/files and personalize content as need: <code class="highlighter-rouge">about/</code>, <code class="highlighter-rouge">posts/</code>, <code class="highlighter-rouge">tags/</code>, <code class="highlighter-rouge">feed.xml</code> and <code class="highlighter-rouge">index.html</code>.</li>
<li>Edit <code class="highlighter-rouge">_config.yml</code> to personalize your site.</li>
<hr />
<h2 id="running-jekyll">Running Jekyll</h2>
<p>The preferred method for running Jekyll is with <code class="highlighter-rouge">bundle exec</code>, but if you’re willing to deal gem conflicts feel free to go cowboy with a <code class="highlighter-rouge">jekyll build</code> or <code class="highlighter-rouge">jekyll serve</code>.</p>
<p>In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.</p>
<p>However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>bundle <span class="nb">exec </span>jekyll build
bundle <span class="nb">exec </span>jekyll serve
<hr />
<h2 id="folder-structure">Folder Structure</h2>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>hpstr-jekyll-theme/
├── _includes
| ├── browser-upgrade.html <span class="c"># prompt to upgrade browser on &lt; IE8</span>
| ├── footer.html <span class="c"># site footer</span>
| ├── head.html <span class="c"># site head</span>
| ├── navigation.html <span class="c"># site navigation</span>
| └── scripts.html <span class="c"># jQuery, plugins, GA, etc</span>
├── _layouts
| ├── page.html <span class="c"># page layout</span>
| ├── page.html <span class="c"># post-index layout used on home page</span>
| └── post.html <span class="c"># post layout</span>
├── _posts
├── _sass <span class="c"># Sass partials</span>
├── assets
| ├── css <span class="c"># compiled stylesheets</span>
| ├── js
| | ├── _main.js <span class="c"># plugin options</span>
| | ├── scripts.min.js <span class="c"># concatenated and minifed site scripts</span>
| | ├── plugins <span class="c"># plugin scripts</span>
| └── └── vendor <span class="c"># jQuery and Modernizr scripts</span>
├── images <span class="c"># images for posts and pages</span>
├── _config.yml <span class="c"># Jekyll options</span>
├── about/ <span class="c"># about page</span>
├── posts/ <span class="c"># all posts</span>
├── tags/ <span class="c"># all posts grouped by tag</span>
└── index.html <span class="c"># home page with pagination</span>
<hr />
<h2 id="customization">Customization</h2>
<p>Most of the variables found here are used in the .html files found in <code class="highlighter-rouge">_includes</code> if you need to add or remove anything. A good place to start would be to add the <code class="highlighter-rouge">title</code>, <code class="highlighter-rouge">description</code>, and <code class="highlighter-rouge">url</code> for your site. Links are absolute and prefixed with <code class="highlighter-rouge"><span class="p">{</span><span class="err">{</span><span class="w"> </span><span class="err">site.url</span><span class="w"> </span><span class="p">}</span><span class="err">}</span></code> in the various <code class="highlighter-rouge">_includes</code> and <code class="highlighter-rouge">_layouts</code>, so remember to properly set <code class="highlighter-rouge">url</code><sup id="fnref:1"><a href="#fn:1" class="footnote">1</a></sup> to <code class="highlighter-rouge">http://localhost:4000</code> when developing locally.</p>
<h3 id="disqus-comments">Disqus Comments</h3>
<p>Create a <a href="">Disqus</a> account and change <code class="highlighter-rouge">disqus_shortname</code> in <code class="highlighter-rouge">_config.yml</code> to the Disqus <em>shortname</em> you just setup. By default comments appear on all post and pages if you assigned a shortname. To disable commenting on a post or page, add the following to its YAML Front Matter:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">comments</span><span class="pi">:</span> <span class="s">false</span>
<h3 id="social-share-links">Social Share Links</h3>
<p>To disable Facebook, Twitter, and Google+ share links on a post or page, add the following to its front matter:</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">share</span><span class="pi">:</span> <span class="s">false</span>
<h3 id="ownerauthor-information">Owner/Author Information</h3>
<p>Change your name, and avatar photo (200x200 pixels or larger), email, and social networking URLs. If you want to link to an external image on Gravatar or something similar you’ll need to edit the path in <code class="highlighter-rouge">navigation.html</code> since it assumes it is located in <code class="highlighter-rouge">/images</code>.</p>
<h3 id="google-analytics-and-webmaster-tools">Google Analytics and Webmaster Tools</h3>
<p>Your Google Analytics ID goes here along with meta tags for <a href=";answer=35179">Google Webmaster Tools</a> and <a href="">Bing Webmaster Tools</a> site verification.</p>
<h3 id="navigation-links">Navigation Links</h3>
<p>To add additional links in the drop down menu edit <code class="highlighter-rouge">_data/navigation.yml</code>. Use the following format to set the URL and title for as many links as you’d like. <em>External links will open in a new window.</em></p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="pi">-</span> <span class="s">title</span><span class="pi">:</span> <span class="s">Portfolio</span>
<span class="s">url</span><span class="pi">:</span> <span class="s">/portfolio/</span>
<span class="pi">-</span> <span class="s">title</span><span class="pi">:</span> <span class="s">Made Mistakes</span>
<span class="s">url</span><span class="pi">:</span> <span class="s"></span>
<hr />
<h2 id="adding-new-content">Adding New Content</h2>
<p>Posts are stored in the <code class="highlighter-rouge">_posts</code> directory and named according to the <code class="highlighter-rouge">YEAR-MONTH-DAY-title.MARKUP</code> format as per <a href="">the usual</a>.</p>
<p>To streamline the creation of posts and pages, <a href="">Jekyll::Compose</a> and <a href="">Octopress</a> are great plugins you can install to automate this process.</p>
<hr />
<h3 id="jekyll-_includes">Jekyll _includes</h3>
<p>For the most part you can leave these as is since the author/owner details are pulled from <code class="highlighter-rouge">_config.yml</code>. That said you’ll probably want to customize the copyright stuff in <code class="highlighter-rouge">footer.html</code> to your liking.</p>
<h3 id="reading-time">Reading Time</h3>
<p>On by default. To turn off remove <code class="highlighter-rouge">reading_time</code> from <code class="highlighter-rouge">_config.yml</code>. Default words per minute is set at 200 and can changed by updating <code class="highlighter-rouge">words_per_minute</code> in <code class="highlighter-rouge">_config.yml</code>.</p>
<h3 id="feature-images">Feature Images</h3>
<p>A good rule of thumb is to keep feature images nice and wide so you don’t push the body text too far down. An image cropped around around 1024 x 256 pixels will keep file size down with an acceptable resolution for most devices. If you want to serve these images responsively I’d suggest looking at the <a href="">Jekyll Picture Tag</a><sup id="fnref:2"><a href="#fn:2" class="footnote">2</a></sup> plugin.</p>
<p>The two layouts make the assumption that the feature images live in the <em>images</em> folder. To add a feature image to a post or page just include the filename in the front matter like so.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">image</span><span class="pi">:</span>
<span class="s">feature</span><span class="pi">:</span> <span class="s">feature-image-filename.jpg</span>
<span class="s">thumb</span><span class="pi">:</span> <span class="s">thumbnail-image.jpg</span> <span class="c1">#keep it square 200x200 px is good</span>
<p>If you want to apply attribution to a feature image use the following YAML front matter on posts or pages. Image credits appear directly below the feature image with a link back to the original source.</p>
<div class="language-yaml highlighter-rouge"><pre class="highlight"><code><span class="s">image</span><span class="pi">:</span>
<span class="s">feature</span><span class="pi">:</span> <span class="s">feature-image-filename.jpg</span>
<span class="s">credit</span><span class="pi">:</span> <span class="s">Michael Rose</span> <span class="c1">#name of the person or site you want to credit</span>
<span class="s">creditlink</span><span class="pi">:</span> <span class="s"></span> <span class="c1">#url to their site or licensing</span>
<p>By default the <code class="highlighter-rouge">&lt;div&gt;</code> containing feature images is set to have a minimum height of 400px with CSS. Anything taller is hidden with an <code class="highlighter-rouge">overflow: hidden</code> declaration. You can customize the height of the homepage feature image and those appearing on posts/pages by modifying the following variables in <code class="highlighter-rouge">/_sass/_variables.scss</code>.</p>
<div class="language-scss highlighter-rouge"><pre class="highlight"><code><span class="nv">$feature-image-height</span><span class="p">:</span> <span class="m">400px</span><span class="p">;</span> <span class="c1">// min 150px recommended
</span><span class="nv">$front-page-feature-image-height</span><span class="p">:</span> <span class="m">400px</span><span class="p">;</span> <span class="c1">// min 150px recommended
<h4 id="postpage-thumbnails-for-og-and-twitter-cards">Post/Page Thumbnails for OG and Twitter Cards</h4>
<p>Post and page thumbnails work the same way. These are used by <a href="">Open Graph</a> and <a href="">Twitter Cards</a> meta tags found in <code class="highlighter-rouge">head.html</code>. If you don’t assign a thumbnail the image you assigned to <code class="highlighter-rouge">site.owner.avatar</code> in <code class="highlighter-rouge">_config.yml</code> will be used.</p>
<p>Here’s an example of what a tweet to your site could look like if you activate Twitter Cards and include all the metas in your post’s YAML.</p>
<p><img src="" alt="Twitter Card summary large image screenshot" /></p>
<h3 id="videos">Videos</h3>
<p>Video embeds are responsive and scale with the width of the main content block with the help of <a href="">FitVids</a>.</p>
<h3 id="twitter-cards">Twitter Cards</h3>
<p>Twitter cards make it possible to attach images and post summaries to Tweets that link to your content. Summary Card meta tags have been added to <code class="highlighter-rouge">head.html</code> to support this, you just need to <a href="">validate and apply your domain</a> to turn it on.</p>
<h3 id="link-post-type">Link Post Type</h3>
<p>Link blog like a champ by adding <code class="highlighter-rouge">link: http://url-you-want-linked</code> to a post’s YAML front matter. Arrow glyph links to the post’s permalink and the the <code class="highlighter-rouge">post-title</code> links to the source URL. Here’s an <a href="">example of a link post</a> if you need a visual.</p>
<hr />
<h2 id="further-customization">Further Customization</h2>
<p>Jekyll 2.x added support for Sass files making it much easier to modify a theme’s fonts and colors. By editing values found in <code class="highlighter-rouge">_sass/variables.scss</code> you can fine tune the site’s colors and typography.</p>
<p>For example if you wanted a red background instead of white you’d change <code class="highlighter-rouge">$bodycolor: #fff;</code> to <code class="highlighter-rouge">$bodycolor: $cc0033;</code>.</p>
<p>To modify the site’s JavaScript files I setup a Grunt build script to lint/concatenate/minify all scripts into <code class="highlighter-rouge">scripts.min.js</code>. <a href="">Install Node.js</a>, then <a href="">install Grunt</a>, and then finally install the dependencies for the theme contained in <code class="highlighter-rouge">package.json</code>:</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>npm install
<p>From the theme’s root, use <code class="highlighter-rouge">grunt</code> to concatenate JavaScript files and optimize <code class="highlighter-rouge">.jpg</code>, <code class="highlighter-rouge">.png</code> and <code class="highlighter-rouge">.svg</code> files in the <code class="highlighter-rouge">images/</code> folder.</p>
<p>You can also use <code class="highlighter-rouge">grunt dev</code> in combination with <code class="highlighter-rouge">bundle exec jekyll serve</code> to watch for updates in JS files that Grunt will then automatically re-build as you write your code, which will in turn auto-generate your Jekyll site when developing locally.</p>
<hr />
<h2 id="questions">Questions?</h2>
<p>Having a problem getting something to work or want to know why I setup something in a certain way? Ping me on Twitter <a href="">@mmistakes</a> or <a href="">file a GitHub Issue</a>. And if you make something cool with this theme feel free to let me know.</p>
<hr />
<h2 id="license">License</h2>
<p>This theme is free and open source software, distributed under the <a href="">MIT License</a> version 2 or later. So feel free to to modify this theme to suit your needs.</p>
<hr />
<div class="footnotes">
<li id="fn:1">
<p>Used to generate absolute URLs in <code class="highlighter-rouge">feed.xml</code>, and for canonical URLs in <code class="highlighter-rouge">head.html</code>. Don’t include a trailing <code class="highlighter-rouge">/</code> in your base url ie: When developing locally I suggest using http://localhost:4000 or whatever localhost you’re using to properly load all theme stylesheets, scripts, and image assets. If you leave this variable blank all links will resolve correctly except those pointing to home.&nbsp;<a href="#fnref:1" class="reversefootnote">&#8617;</a></p>
<li id="fn:2">
<p>If you’re using GitHub Pages to host your site be aware that plugins are disabled. So you’ll need to build your site locally and then manually deploy if you want to use this sweet plugin.&nbsp;<a href="#fnref:2" class="reversefootnote">&#8617;</a></p>
<div class="entry-meta">
<span>发布于 <span class="entry-date date published updated"><time datetime="2016-06-02 03:14:43 +0800">2016-06-02</time></span></span>
<span class="author vcard"><span class="fn">ECharts</span></span>
</div><!-- /.entry-content -->
</div><!-- /#main -->
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-4 logo"><img src=""/></div>
<div id="efe-product" class="col-md-2 col-sm-4 pc">
<ul id="efe-product">
<li><a href="" target="_blank">图说</a></li>
<li><a href="" target="_blank">SAN</a></li>
<li><a href="" target="_blank">EDP</a></li>
<li><a href="" target="_blank">ZRender</a></li>
<li><a href="" target="_blank">FECS</a></li>
<li><a href="" target="_blank">Fontmin</a></li>
<div class="col-md-3 col-md-offset-1 col-sm-4 pc">
<li><a href="" target="_blank">FEX</a></li>
<li><a href="" target="_blank">百度技术学院</a></li>
<li><a href="" target="_blank">码云镜像</a></li>
<div class="col-md-3" id="footer-icon-panel">
<div class="icon-panel">
<a href="" class="footer-icon">
<img src=""/>
<a href="" class="footer-icon">
<img src=""/>
<a href="" class="footer-icon">
<img src=""/>
<a href="" class="footer-icon">
<img src=""/>
<div id="echarts-copyright">&#9400; 2017 百度ECharts团队出品</div>
<script src=""></script>
<script src=""></script>
<script src=""></script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);