Tips and automation scripts for blogging with Jekyll and Minimal Mistakes.
Create a sub-module in your blog repo under the _scripts directory.
Run the scripts from the root of your blog repo, _scripts/_<command>
. They will print out an example usage line.
_absolutify_links.sh
to make link absolute so that they display well emails_check_fixmes.sh
to grep all FIXME comments that might be left in the files_check_links.sh
to grep for all bad links (ex: relative, or local only)_grep_tweets.sh
greps a post for bold sentences that could be tweeted_new_post.sh
creates a new post skeleton_preview.sh
runs a local server to see local changes_word_count.rb
Computes the number of words in a post
Here are common reminders and fixes.
[comment]: # (this is a comment)
See https://stackoverflow.com/questions/4823468/comments-in-markdown for the explanation
- Check the ruby version in ../.ruby-version.
- Head to https://rubyinstaller.org/downloads/, and download the appropriate Ruby+Devkit installer
- Run the installer, when asked for what to install in the command line, choose option '3'
- Open a git-bash and head to the blog main dir
- Run
bundle install
- Run
_scripts/_preview.sh
and check that the website is available
Gems need to be updated regularly:
brew upgrade rbenv ruby-build
rbenv install --list
rbenv install xxx
Update .ruby-version
bundle update
Test with _scripts/_preview.sh
and _scripts/_local_preview.sh
Here is the template I am using :
{% assign figure_path="/imgs/...todo.jpg" | absolute_url %}
{% assign figure_alt="TODO" %}
{% capture figure_caption %}
TODO markdown
{% endcapture %}
{% include figure image_path=figure_path alt=figure_alt caption=figure_caption %}
- Teaser images : 600x315, 72dpi, compressed for minimal size (appears on the front page!)
- Open Graph images : 1800x945, 250dpi, not compressed to appear well on high precision devices
- Might be easier to resize the image to 1800x945 ratio (same as teaser images)
- Stamp the image, use gimp and add the layer from insert-cc.xmp
- Resize image as needed
- Add credits to the image in the page
{% assign figure_path="/imgs/...todo.jpg" | absolute_url %}
{% assign figure_alt="TODO" %}
{% capture figure_caption %}
By [Philippe Bourgau]({{site.url}}), under [CC BY-SA 4.0](http://creativecommons.org/licenses/by-sa/4.0/), [high resolution image]({{site.url}}{{site.baseurl}}/imgs/...todo.jpg)
{% endcapture %}
{% include figure image_path=figure_path alt=figure_alt caption=figure_caption %}
- Generate .xmp metadata from Creative Commons website
- Add the metadata to images with
exiftool -tagsFromFile CC_Attribution-ShareAlike_4.0_International.xmp xxx1.jpg xxx2.jpg...
From https://www.christiankonline.com/twitter-retweet-link-tutorial/
- First send a tweet with the high-res image (cf Images best sizes)
- Write down the tweet-id
- Add this markdown under the image, with the new tweet-id
[Retweet this image](https://twitter.com/intent/retweet?tweet_id=\<TWEET_ID\>)
This can be useful to generate tweets or variations for Recurpost.
_scripts/_grep_tweets.sh POST_FILE_PATH
This dump usually needs further editing.
TODO:
- This does not take the quotes into account
- It would be nice to uppercase the first letter
Just run the following command:
find _posts -type f -and -name "*.markdown" -exec bundle exec ruby _word_count.rb {} \; > tmp/word_counts.csv
You'll need the following pre-requisites:
- Ruby
- Python3
- Init submodule markdown-word-count