-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhow-im-using-pelican.html
More file actions
96 lines (82 loc) · 5.26 KB
/
how-im-using-pelican.html
File metadata and controls
96 lines (82 loc) · 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>How I'm using Pelican</title>
<link rel="stylesheet" href="./theme/css/main.css" />
</head>
<body id="index" class="home">
<header id="banner" class="body">
<h1><a href="./">The Train Station</a></h1>
<nav><ul>
<li><a href="./category/development.html">Development</a></li>
<li class="active"><a href="./category/general.html">General</a></li>
</ul></nav>
</header><!-- /#banner -->
<section id="content" class="body">
<article>
<header>
<h1 class="entry-title">
<a href="./how-im-using-pelican.html" rel="bookmark"
title="Permalink to How I'm using Pelican">How I'm using Pelican</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2019-06-15T14:15:00-05:00">
Published: Sat 15 June 2019
</abbr>
<address class="vcard author">
By <a class="url fn" href="./author/seth-buntin.html">Seth Buntin</a>
</address>
<p>In <a href="./category/general.html">General</a>.</p>
<p>tags: <a href="./tag/vim.html">vim</a> <a href="./tag/pelican.html">pelican</a> </p>
</footer><!-- /.post-info --> <p>I've obviously just recently got back into writing a blog or whatever you want to call this. The honest reason was because I was
at home one weekend while my family was visting other family members. Just a couple of weeks prior I had bought an
<a href="https://www.alpacakeyboards.com/">Ergodox 76 Hotdox</a> which I use mainly at work. My typing has gradually gotten better but I wanted
to use this time to continue to get better so I'm forcing myself to use it.</p>
<h2>Pelican</h2>
<p>There are many static site generators so I did a quick search for "Python static site generator" (Python is still my go to language)
and an <a href="https://www.fullstackpython.com/static-site-generator.html">article</a> that mentioned <a href="http://docs.getpelican.com/en/stable/">Pelican</a>
showed up first. I stuck with it and wanted to share how am producing these articles.</p>
<h2>Python</h2>
<p>As I mentioned in an earlier article I have <code>pyenv</code> and <code>pipenv</code> setup. Here is my <code>Pipfile</code> for <a href="https://sethtrain.github.io">https://sethtrain.github.io</a></p>
<div class="highlight"><pre><span></span><code><span class="k">[[source]]</span>
<span class="na">url</span> <span class="o">=</span> <span class="s">"https://pypi.org/simple"</span>
<span class="na">verify_ssl</span> <span class="o">=</span> <span class="s">true</span>
<span class="na">name</span> <span class="o">=</span> <span class="s">"pypi"</span>
<span class="k">[packages]</span>
<span class="na">pelican</span> <span class="o">=</span> <span class="s">"*"</span>
<span class="na">markdown</span> <span class="o">=</span> <span class="s">"*"</span>
<span class="k">[scripts]</span>
<span class="na">generate</span> <span class="o">=</span> <span class="s">"pelican content --output ."</span>
<span class="na">preview</span> <span class="o">=</span> <span class="s">"pelican -l --output ."</span>
<span class="k">[requires]</span>
<span class="na">python_version</span> <span class="o">=</span> <span class="s">"3.7.3"</span>
</code></pre></div>
<p>To get up and running, install these dependencies and then run <code>pelican-quickstart</code>. It will walk you through a couple of questions
and get everything started for you. The <a href="http://docs.getpelican.com/en/stable/quickstart.html">documentation</a> does a good job of
explaining all of this.</p>
<p>It is pretty simple. I create a new <a href="https://daringfireball.net/projects/markdown/">markdown</a> file in the <code>content</code> directory.
When I feel like I am done I will generate the site, do a quick preview locally to see if I have any issues and then push to GitHub.</p>
<h2>Vim</h2>
<p>I had established a couple of <code><leader></code> bindings for Pelican projects to help me generate and preview quickly. <a href="https://github.com/tpope/vim-dispatch">vim-dispatch</a>
makes this possible and easy.</p>
<div class="highlight"><pre><span></span><code><span class="err">if filereadable("pelicanconf.py")</span>
<span class="err"> nmap <leader>G :Dispatch pipenv run generate<cr></span>
<span class="err"> nmap <leader>R :Dispatch pipenv run preview<cr></span>
<span class="err">endif</span>
</code></pre></div>
<p>Have fun!</p>
</div><!-- /.entry-content -->
</article>
</section>
<section id="extras" class="body">
</section><!-- /#extras -->
<footer id="contentinfo" class="body">
<address id="about" class="vcard body">
Proudly powered by <a href="http://getpelican.com/">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.
</address><!-- /#about -->
<p>The theme is by <a href="http://coding.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
</footer><!-- /#contentinfo -->
</body>
</html>