aboutsummaryrefslogtreecommitdiff
path: root/docs/posts/static_sites_with_bash/index.html
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-02-09 04:54:03 +0000
committerAkshay <[email protected]>2020-02-09 04:54:03 +0000
commit359a92f770e621828e628f319290bb5736b1f67b (patch)
treec4c4e5168c22ac13cd62c2ee03ef1a4334aa10fc /docs/posts/static_sites_with_bash/index.html
parent75c5c6044170bd6cc23502a6f40f15378269b3d1 (diff)
new styles, new post!
Diffstat (limited to 'docs/posts/static_sites_with_bash/index.html')
-rw-r--r--docs/posts/static_sites_with_bash/index.html27
1 files changed, 14 insertions, 13 deletions
diff --git a/docs/posts/static_sites_with_bash/index.html b/docs/posts/static_sites_with_bash/index.html
index 7c1adda..9eb4846 100644
--- a/docs/posts/static_sites_with_bash/index.html
+++ b/docs/posts/static_sites_with_bash/index.html
@@ -10,6 +10,7 @@
10 <meta property="og:type" content="website"> 10 <meta property="og:type" content="website">
11 <meta property="og:description" content="a static site {for, by, about} me "> 11 <meta property="og:description" content="a static site {for, by, about} me ">
12 <meta property="og:url" content="https://peppe.rs"> 12 <meta property="og:url" content="https://peppe.rs">
13 <link rel="icon" type="image/x-icon" href="/favicon.png">
13 <title>Static Sites With Bash - peppe.rs</title> 14 <title>Static Sites With Bash - peppe.rs</title>
14 <body> 15 <body>
15 <div class="posts"> 16 <div class="posts">
@@ -51,17 +52,17 @@ to html with <a href="https://kristaps.bsd.lv/lowdown/">lowdown</a>.</p>
51<h3 id="Directory%20structure">Directory structure</h3> 52<h3 id="Directory%20structure">Directory structure</h3>
52 53
53<p>I host my site on GitHub pages, so 54<p>I host my site on GitHub pages, so
54<code>docs/</code> has to be the entry point. Markdown formatted posts 55<code>docs&#47;</code> has to be the entry point. Markdown formatted posts
55go into <code>posts/</code>, get converted into html, and end up in 56go into <code>posts&#47;</code>, get converted into html, and end up in
56<code>docs/index.html</code>, something like this:</p> 57<code>docs&#47;index.html</code>, something like this:</p>
57 58
58<pre><code>posts=$(ls -t ./posts) # chronological order! 59<pre><code>posts=$(ls -t .&#47;posts) # chronological order!
59for f in $posts; do 60for f in $posts; do
60 file=&quot;./posts/&quot;$f # `ls` mangled our file paths 61 file=&#34;.&#47;posts&#47;&#34;$f # `ls` mangled our file paths
61 echo &quot;generating post $file&quot; 62 echo &#34;generating post $file&#34;
62 63
63 html=$(lowdown &quot;$file&quot;) 64 html=$(lowdown &#34;$file&#34;)
64 echo -e &quot;html&quot; &gt;&gt; docs/index.html 65 echo -e &#34;html&#34; &#62;&#62; docs&#47;index.html
65done 66done
66</code></pre> 67</code></pre>
67 68
@@ -72,15 +73,15 @@ assets into the site source itself. That does have it&#8217;s
72merits, but I prefer hosting images separately:</p> 73merits, but I prefer hosting images separately:</p>
73 74
74<pre><code># strip file extension 75<pre><code># strip file extension
75ext=&quot;${1##*.}&quot; 76ext=&#34;${1##*.}&#34;
76 77
77# generate a random file name 78# generate a random file name
78id=$( cat /dev/urandom | tr -dc &#39;a-zA-Z0-9&#39; | fold -w 2 | head -n 1 ) 79id=$( cat &#47;dev&#47;urandom | tr -dc &#39;a-zA-Z0-9&#39; | fold -w 2 | head -n 1 )
79id=&quot;$id.$ext&quot; 80id=&#34;$id.$ext&#34;
80 81
81# copy to my file host 82# copy to my file host
82scp -P 443 &quot;$1&quot; emerald:files/&quot;$id&quot; 83scp -P 443 &#34;$1&#34; emerald:files&#47;&#34;$id&#34;
83echo &quot;https://u.peppe.rs/$id&quot; 84echo &#34;https:&#47;&#47;u.peppe.rs&#47;$id&#34;
84</code></pre> 85</code></pre>
85 86
86<h3 id="Templating">Templating</h3> 87<h3 id="Templating">Templating</h3>