Files
2020-08-02 21:53:41 +08:00

514 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="en" dir=>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="theme-color" content="#FFFFFF"><meta property="og:title" content="Blog" />
<meta property="og:description" content="" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://books.halfrost.com/leetcode/posts/" />
<meta property="og:updated_time" content="2014-09-28T00:00:00+00:00" />
<title>Blog | LeetCode Cookbook</title>
<link rel="manifest" href="/leetcode/manifest.json">
<link rel="icon" href="/leetcode/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="/leetcode/book.min.6cd8553a6854f4812343f0f0c8baca31271e686434f381fbe3c7226f66639176.css" integrity="sha256-bNhVOmhU9IEjQ/DwyLrKMSceaGQ084H748cib2ZjkXY=">
<script defer src="/leetcode/en.search.min.b89b298482a620ecdc3740829351c9d8b19cc485f00b83eaf4b57f44e1cb7e23.js" integrity="sha256-uJsphIKmIOzcN0CCk1HJ2LGcxIXwC4Pq9LV/ROHLfiM="></script>
<link rel="alternate" type="application/rss+xml" href="https://books.halfrost.com/leetcode/posts/index.xml" title="LeetCode Cookbook" />
<!--
Made with Book Theme
https://github.com/alex-shpak/hugo-book
-->
</head>
<body dir=>
<input type="checkbox" class="hidden toggle" id="menu-control" />
<input type="checkbox" class="hidden toggle" id="toc-control" />
<main class="container flex">
<aside class="book-menu">
<nav>
<h2 class="book-brand">
<a href="/leetcode"><span>LeetCode Cookbook</span>
</a>
</h2>
<div class="book-search">
<input type="text" id="book-search-input" placeholder="Search" aria-label="Search" maxlength="64" data-hotkeys="s/" />
<div class="book-search-spinner hidden"></div>
<ul id="book-search-results"></ul>
</div>
<ul>
<li>
<a href="https://halfrost.com" target="_blank" rel="noopener">
被人嘲笑的梦想
</a>
</li>
<li>
<a href="https://github.com/halfrost" target="_blank" rel="noopener">
Github
</a>
</li>
<li>
<a href="https://halfrost.com" target="_blank" rel="noopener">
微信公众号
</a>
</li>
<li>
<a href="https://twitter.com/halffrost" target="_blank" rel="noopener">
Twitter
</a>
</li>
<li>
<a href="https://weibo.com/halfrost" target="_blank" rel="noopener">
Weibo
</a>
</li>
</ul>
<ul>
<li>
<p>
<a href="/leetcode/docs/example/"><strong>Example Site</strong></a></p>
</li>
<li>
<p>
<a href="/leetcode/docs/example/table-of-contents/">Table of Contents</a></p>
<ul>
<li>
<a href="/leetcode/docs/example/table-of-contents/with-toc/">With ToC</a></li>
<li>
<a href="/leetcode/docs/example/table-of-contents/without-toc/">Without ToC</a></li>
</ul>
</li>
<li>
<p>
<a href="/leetcode/docs/example/collapsed/">Collapsed</a></p>
<ul>
<li>
<a href="/leetcode/docs/example/collapsed/3rd-level/">3rd</a>
<ul>
<li>
<a href="/leetcode/docs/example/collapsed/3rd-level/4th-level/">4th</a>
<br /></li>
</ul>
</li>
</ul>
</li>
<li>
<p><strong>Shortcodes</strong></p>
</li>
<li>
<p>
<a href="/leetcode/docs/shortcodes/buttons/">Buttons</a></p>
</li>
<li>
<p>
<a href="/leetcode/docs/shortcodes/columns/">Columns</a></p>
</li>
<li>
<p>
<a href="/leetcode/docs/shortcodes/expand/">Expand</a></p>
</li>
<li>
<p>
<a href="/leetcode/docs/shortcodes/hints/">Hints</a></p>
</li>
<li>
<p>
<a href="/leetcode/docs/shortcodes/katex/">Katex</a></p>
</li>
<li>
<p>
<a href="/leetcode/docs/shortcodes/mermaid/">Mermaid</a></p>
</li>
<li>
<p>
<a href="/leetcode/docs/shortcodes/tabs/">Tabs</a>
<br /></p>
</li>
</ul>
<ul>
<li>
<a href="/leetcode/posts/" >
Blog
</a>
</li>
</ul>
</nav>
<script>(function(){var menu=document.querySelector("aside.book-menu nav");addEventListener("beforeunload",function(event){localStorage.setItem("menu.scrollTop",menu.scrollTop);});menu.scrollTop=localStorage.getItem("menu.scrollTop");})();</script>
</aside>
<div class="book-page">
<header class="book-header">
<div class="flex align-center justify-between">
<label for="menu-control">
<img src="/leetcode/svg/menu.svg" class="book-icon" alt="Menu" />
</label>
<strong>Blog</strong>
<label for="toc-control">
<img src="/leetcode/svg/toc.svg" class="book-icon" alt="Table of Contents" />
</label>
</div>
<aside class="hidden clearfix">
<nav>
<ul>
<li class="book-section-flat">
<strong>Categories</strong>
<ul>
<li class="flex justify-between">
<a href="/leetcode/categories/Development/">Development</a>
<span>2</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/categories/golang/">golang</a>
<span>2</span>
</li>
</ul>
</li>
<li class="book-section-flat">
<strong>Tags</strong>
<ul>
<li class="flex justify-between">
<a href="/leetcode/tags/development/">development</a>
<span>2</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/go/">go</a>
<span>2</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/golang/">golang</a>
<span>2</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/hugo/">hugo</a>
<span>1</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/templates/">templates</a>
<span>1</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/themes/">themes</a>
<span>1</span>
</li>
</ul>
</li>
</ul>
</nav>
</aside>
</header>
<article class="markdown book-post">
<h2>
<a href="/leetcode/posts/creating-a-new-theme/">Creating a New Theme</a>
</h2>
<h5>Sep 28, 2014</h5>
<p>Introduction # This tutorial will show you how to create a simple theme in Hugo. I assume that you are familiar with HTML, the bash command line, and that you are comfortable using Markdown to format content. I&rsquo;ll explain how Hugo uses templates and how you can organize your templates to create a theme. I won&rsquo;t cover using CSS to style your theme.
We&rsquo;ll start with creating a new site with a very basic template.
<a href="/leetcode/posts/creating-a-new-theme/">...</a>
</p>
</article>
<article class="markdown book-post">
<h2>
<a href="/leetcode/posts/migrate-from-jekyll/">Migrate to Hugo from Jekyll</a>
</h2>
<h5>Mar 10, 2014</h5>
<p>Move static content to static # Jekyll has a rule that any directory not starting with _ will be copied as-is to the _site output. Hugo keeps all static content under static. You should therefore move it all there. With Jekyll, something that looked like
&lt;root&gt;/ ▾ images/ logo.png should become
&lt;root&gt;/ ▾ static/ ▾ images/ logo.png Additionally, you&rsquo;ll want any files that should reside at the root (such as CNAME) to be moved to static.
<a href="/leetcode/posts/migrate-from-jekyll/">...</a>
</p>
</article>
<article class="markdown book-post">
<h2>
<a href="/leetcode/posts/goisforlovers/">(Hu)go Template Primer</a>
</h2>
<h5>Apr 2, 2014</h5>
<div>
<a href="/leetcode/categories/Development/">Development</a>,
<a href="/leetcode/categories/golang/">golang</a>
</div>
<div>
<a href="/leetcode/tags/go/">go</a>,
<a href="/leetcode/tags/golang/">golang</a>,
<a href="/leetcode/tags/templates/">templates</a>,
<a href="/leetcode/tags/themes/">themes</a>,
<a href="/leetcode/tags/development/">development</a>
</div>
<p>Hugo uses the excellent Go html/template library for its template engine. It is an extremely lightweight engine that provides a very small amount of logic. In our experience that it is just the right amount of logic to be able to create a good static website. If you have used other template systems from different languages or frameworks you will find a lot of similarities in Go templates.
This document is a brief primer on using Go templates.
<a href="/leetcode/posts/goisforlovers/">...</a>
</p>
</article>
<article class="markdown book-post">
<h2>
<a href="/leetcode/posts/hugoisforlovers/">Getting Started with Hugo</a>
</h2>
<h5>Apr 2, 2014</h5>
<div>
<a href="/leetcode/categories/Development/">Development</a>,
<a href="/leetcode/categories/golang/">golang</a>
</div>
<div>
<a href="/leetcode/tags/go/">go</a>,
<a href="/leetcode/tags/golang/">golang</a>,
<a href="/leetcode/tags/hugo/">hugo</a>,
<a href="/leetcode/tags/development/">development</a>
</div>
<p>Step 1. Install Hugo # Go to Hugo releases and download the appropriate version for your OS and architecture.
Save it somewhere specific as we will be using it in the next step.
More complete instructions are available at Install Hugo
Step 2. Build the Docs # Hugo has its own example site which happens to also be the documentation site you are reading right now.
Follow the following steps:
<a href="/leetcode/posts/hugoisforlovers/">...</a>
</p>
</article>
<footer class="book-footer">
<div class="flex flex-wrap justify-between">
</div>
</footer>
<label for="menu-control" class="hidden book-menu-overlay"></label>
</div>
<aside class="book-toc">
<nav>
<ul>
<li class="book-section-flat">
<strong>Categories</strong>
<ul>
<li class="flex justify-between">
<a href="/leetcode/categories/Development/">Development</a>
<span>2</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/categories/golang/">golang</a>
<span>2</span>
</li>
</ul>
</li>
<li class="book-section-flat">
<strong>Tags</strong>
<ul>
<li class="flex justify-between">
<a href="/leetcode/tags/development/">development</a>
<span>2</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/go/">go</a>
<span>2</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/golang/">golang</a>
<span>2</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/hugo/">hugo</a>
<span>1</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/templates/">templates</a>
<span>1</span>
</li>
<li class="flex justify-between">
<a href="/leetcode/tags/themes/">themes</a>
<span>1</span>
</li>
</ul>
</li>
</ul>
</nav>
</aside>
</main>
</body>
</html>