Mind mumbles

Cerebral sprouts from the convoluted plain

Bashblog - explaining the configuration settings

August 17, 2017 — Nalioth

As bashblog is being used to generate this blog, I thought I'd provide some insights into the configuration.

If you visit the bashblog page at Github, you can click on the script and read the code. Bashblog supports an external configuration file, and I recommend you use one. By using an external configuration file, you don't have to worry about updating the script itself, as you would if you made your changes directly in it. You may also download bashblog-config.example and modify it as needed.

I am not the author of the script, but will do my best to explain - in layman's terms - what these configuration settings do

This should only be changed if you're running multiple scripts or programs and ".config" is already being used by another file.

# Config file. Any settings "key=value" written there will override the
# global_variables defaults. Useful to avoid editing bb.sh and having to deal
# with merges in VCS

Nothing needs doing here.

# This function will load all the variables defined here. They might be overridden
# by the 'global_config' file contents
global_variables() {

This block is fairly obvious. The "global URL" will be used as the blog's base URL. Do not use a trailing slash on the URL.

# Blog title
    global_title="My fancy blog"
    # The typical subtitle for each blog
    global_description="A blog about turtles and carrots"
    # The public base URL for this blog

This block is fairly obvious. The email will be in the clear, so if you're wanting to avoid spam, you might want to munge whatever you put there ( example: johnREMOVE@smithREMOVE.com )

# Your name
    global_author="John Smith"
    # You can use twitter or facebook or anything for global_author_url
    # Your email

How you copyright your content is entirely up to you.

# CC by-nc-nd is a good starting point, you can change this to "©" for Copyright
    global_license="CC by-nc-nd"

If you have Google Analytics, put the code in the "global analytics' field. Any other tracking codes should be put into a file and called from the latter option.

# If you have a Google Analytics ID (UA-XXXXX) and wish to use the standard
    # embedding code, put it on global_analytics
    # If you have custom analytics code (i.e. non-google) or want to use the Universal
    # code, leave global_analytics empty and specify a global_analytics_file

Feedburner is a feed management provider.

# Leave this empty (i.e. "") if you don't want to use feedburner, 
    # or change it to your own URL

Enabling this section will send folks to your Twitter, where they can leave comments. These comments will be linked to individual blog posts for easy sorting. This is great, as it puts all the load on twitter as far as keeping the spambots and known ne'er-do-wells from littering a dedicated commenting sysstem, should you run one.

Your twitter username starts with a "@" ( example: @nalioth )

If you live in Europe, you can choose to use the cookieless solution, which complies with current EU internet cookie law.

# Change this to your username if you want to use twitter for comments
    # Set this to false for a Twitter button with share count. The cookieless version
    # is just a link.
    # Default search page, where tweets more than a week old are hidden

If you want to use Disqus commenting, this section's for you. I do not recommend Disqus because they track everyone who visits your page, whether they comment or not. Discus is also one of the worst about spamming those sleazy "Click here to see hot girls who lost their pants!" tabloid-type picture linkblocks ON YOUR PAGE

# Change this to your disqus username to use disqus for comments

At this time, I'd recommend you leave this alone. While I'd love to have files output with the .php suffix ( and this option will do it ), the rest of the blog software generates internal links to files with the .html suffix, regardless of what you choose here - leaving you with a broken blog.

# Blog generated files
    # index page of blog (it is usually good to use "index.html" here)
    # global archive

For you guys who run a discrete "about" or "contact" page or other single-purpose non-blog pages.

# Non blogpost files. Bashblog will ignore these. Useful for static pages and custom content
    # Add them as a bash array, e.g. non_blogpost_files=("news.html" "test.html")

How many blog posts do you want shown in your RSS feed?

# feed file (rss in this case)

This is like the "read more" tag in Wordpress. Throwing in an <hr> tag tells the blog to not show anything below the <hr> tag on the index page. Folks will click the "read more" link to read the whole blog post.

# "cut" blog entry when putting it to index page. Leave blank for full articles in front page
    # i.e. include only up to first '<hr>', or '----' in markdown
    # When cutting, cut also tags? If "no", tags will appear in index page for cut articles
    # Regexp matching the HTML line where to do the cut
    # note that slash is regexp separator so you need to prepend it with backslash
    cut_line='<hr ?\/?>'

No habla Markdown

# save markdown file when posting with "bb post -m". Leave blank to discard it.

This is how your tag pages will be titled. Each tag will get its own web page.

# prefix for tags/categories files
    # please make sure that no other html file starts with this prefix

Now, here is where we need to pay attention, as the author's code leaves much to be desired here.
Whatever you put in the header file here will be your entire HEAD element.
The "footer_file" works as most footer elements do

# personalized header and footer (only if you know what you're doing)
    # DO NOT name them .header.html, .footer.html or they will be overwritten
    # leave blank to generate them, recommended

This is where you'd put any banners or whatnot you want loaded at the top of the page as displayed in the browser.

# extra content to add just after we open the  tag
    # and before the actual blog content

This is where you'd put any banners or whatnot you want to be shown at the bottom of the page.

# extra content to add just before we cloese )

This is where your custom CSS file gets loaded. Since I'm lazy, I include both generated files & my custom file in the array.

# CSS files to include on every page, f.ex. css_include=('main.css' 'blog.css')
    # leave empty to use generated

If you're using other files with a .html suffix for extra purposes, list them here or the script will try to incorporate them into your blog. Personally, I use files without a suffix or ending in .php for these "extras", as these are naturally ignored by the script.

# HTML files to exclude from index, f.ex. post_exclude=('imprint.html 'aboutme.html')

Aesthetics and code Barbie.

# Localization and i18n
    # "Comments?" (used in twitter link after every post)
    # "Read more..." (link under cut article on index page)
    template_read_more="Read more..."
    # "View more posts" (used on bottom of index page as link to archive)
    template_archive="View more posts"
    # "All posts" (title of archive page)
    template_archive_title="All posts"
    # "All tags"
    template_tags_title="All tags"
    # "posts" (on "All tags" page, text at the end of each tag line, like "2. Music - 15 posts")
    template_tags_posts_2_4="posts"  # Some slavic languages use a different plural form for 2-4 items
    # "Posts tagged" (text on a title of a page with index of one tag, like "My Blog - Posts tagged "Music"")
    template_tag_title="Posts tagged"
    # "Tags:" (beginning of line in HTML file with list of all tags for this article)
    # "Back to the index page" (used on archive page, it is link to blog index)
    template_archive_index_page="Back to the index page"
    # "Subscribe" (used on bottom of index page, it is link to RSS feed)
    # "Subscribe to this page..." (used as text for browser feed button that is embedded to html)
    template_subscribe_browser_button="Subscribe to this page..."
    # "Tweet" (used as twitter text button for posting to twitter)
    template_twitter_comment="<Type your comment here but please leave the URL so that other people can follow the comments>"

How you want your timestamps to appear

# The locale to use for the dates displayed on screen
    date_format="%B %d, %Y"
    # Don't change these dates
    date_format_full="%a, %d %b %Y %H:%M:%S %z"
    date_allposts_header="%B %Y"

Those are all the configuration settings you should have to worry about. Hope this helps shed some light on the usage of bashblog. Happy blogging!

Tags: bashblog, webmaster, bash-shell

Comments? Tweet  

Shopping at Amazon via this link helps support this blog & other Novarata services. Thanks!
If you are not human,
here is another forum for you to enjoy