rendering code in code is oops

master
Jay 2 years ago
parent 6c4452519f
commit 7abc4ea34c

@ -35,6 +35,7 @@ echo $POSTS
for FILE in $POSTS; do
cp -R $FILE $(pwd)/../
done
```
This script was basically finding the three most recent posts and copying them in to a directory? Why? I thought that's what I had to do. I only wanted a couple of posts on the main page; the way this theme was done it listed ALL of them. Yeah, this is because I'm an idiot and didn't bother actually reading the docs. By this point I just wanted to get ***something*** up. I was starting to feel a large level of defeat which wasn't good in my brain-fogged mental state.
@ -66,6 +67,7 @@ layout: default
{%- endfor -%}
</ul>
{%- endif -%}
```
Which is cool and all; but I'm the kind of person I want my index.md to be my ENTIRE index file. I wanted more flexibility in where I put things. Where as Hugo would have complianed had I tried to put that code in a markdown file; Jekyll let me do this:
@ -95,6 +97,7 @@ Which is cool and all; but I'm the kind of person I want my index.md to be my EN
{% endif %}
{% endfor %}
</ul>
```
I put that right in my index.md where I wanted it; changed the layout from "home" to "default". No complaints about HTML in Markdown; Jekyll just takes all the markdown, renders it as html; and renders all the HTML as HTML.
@ -105,6 +108,7 @@ But that's not really what I came here to talk about. I came to talk about .bash
Let me show you something that cost me two hours:
```
case $- in
*i*) ;;
@ -112,6 +116,7 @@ case $- in
esac
```
This is at the very top of .bashrc. This was a problem.
You see...the one thing I liked about Wordpress was the fact I write a post, I publish, it's up. Static site generators by their very nature don't do this. They support this for development; but it's not a good idea to use them for production use. So I started thinking of ways around this; some kind of landing page on the server to trigger a render, CRONJOB every few minutes...those were about it. I didn't realize githooks were a thing. Even better since I'm running my own git; the scripts are just all local.
@ -124,6 +129,7 @@ Well...this is where my .bashrc file screwed me over. Ruby, gems, and jekyll are
# Install Ruby Gems to ~/gems
export GEM_HOME="$HOME/gems"
export PATH="$HOME/gems/bin:$PATH"
```
These lines specify that all of this goes under your home directory. The problem becomes when .bashrc isn't processed. Those PATHs never get exported to shell. The result? I'm trying to figure out why the hell I'm specifying my .bashrc at every possible step but getting either invalid commands or something wanting root. I mean it's for non-login shells..which are usually non-interactive. But I even got to the point where I was putting the build in an external script and calling that...becuase it "magically worked when I ran the script".
@ -143,6 +149,7 @@ pushd $TMP_GIT_CLONE
bundle install
bundle exec jekyll build -d $PUBLIC_WWW
popd
```
That's literally it. There's probably some fancy way to do it; but this does the same job. Clone the repository, build, GTFO. The temporary directories are cleared out daily; there's a number of write-protected files that hang up the script. So I just do a `rm -r /tmp/blog*` as a root cronjob every 24 hours.

Loading…
Cancel
Save