Simple CGI-Bin based scripts for automatically displaying a list of posts on a website. http://ffog.sdf.org/git/cgi-log/
Go to file
ffog 9aa158de2f Update 'README.md'
cleaning up text
2021-08-08 02:13:50 +00:00
log tweak 2019-09-27 21:14:33 -05:00
README.md Update 'README.md' 2021-08-08 02:13:50 +00:00
home-bottom.htm initial 2019-09-27 21:05:43 -05:00
home-top.htm tweak 2019-09-27 21:14:33 -05:00
index.cgi initial 2019-09-27 21:05:43 -05:00
list.cgi initial 2019-09-27 21:05:43 -05:00
script.js added dash 2019-09-27 21:28:48 -05:00
style.css initial 2019-09-27 21:05:43 -05:00

README.md

CGI-Log

CGI-Log is a few simple CGI-Bin based scripts for automatically displaying a list of posts on a website, useful for small personal sites. Writing it was fun and quicker than downloading something off the shelf.

There's not much code here, anything visual is vanilla HTML. Unix utilities like cat, echo, ls, head, and tail are used to build the HTML pages returned to the client.

Add a page by creating a file for it in the /log/posts folder.

/

  • index.cgi
    Homepage for your index. It calls the other files in /.

  • home-top.htm
    Opening HTML, HEAD, TITLE, BODY, and UL tags. Calls CSS and JS files.

  • list.cgi
    Each file in /log/posts is linked in a LI tag.

  • home-bottom.htm
    Closing UL, BODY, and HTML tags.

  • style.css
    Example CSS.

  • script.js
    Example JAVASCRIPT.

/log

  • index.cgi
    This is the page that loads posts via url query, for example web.com/log/?i=leaf. The most complex code is in this file, for dealing with queries in URL's (which I did not write). It calls the other files in /log.

  • header-top.htm
    Opening HTML, and HEAD tags.

  • header-bottom.htm
    Closing HEAD tag, opening BODY tag. Calls .css and .js files.

  • footer.htm
    Closing BODY and HTML tags.

/log/posts

These are where your posts go. Files are listed on the index by modified date. If you wish to reorder files, you may use the 'touch' unix command. Two files are provided as post examples.

The first line is interpretted as the title of the page, displayed in the TITLE tag and on the index. The rest of the file will be interpretted as HTML. The actual filename for the post is used as the query url.

Note

You may need to alter the first line of each .cgi file to match the location of your shell of choice on your system. It is defaulted to #!/bin/bash. Also make sure your .cgi files are executable, for example 'chmod +x index.cgi'.