User Tools

Site Tools


a_simple_static_site_generator

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
a_simple_static_site_generator [2021/03/15 07:41] – [Running SSG5] fix format peteyboya_simple_static_site_generator [2023/02/23 20:13] – clean up text for clarity peteyboy
Line 11: Line 11:
 > ssg is a static site generator written in shell. Optionally it converts Markdown files to HTML with lowdown(1) or Markdown.pl. > ssg is a static site generator written in shell. Optionally it converts Markdown files to HTML with lowdown(1) or Markdown.pl.
  
 +(note: Markdown.pl is installed on SDF cluster as of this writing, so that's what it will use)
  
 ==== How it Works ==== ==== How it Works ====
Line 31: Line 32:
  
 ===== Clone Git Repo ===== ===== Clone Git Repo =====
-change dirs to a folder that you keep projects in (''~/projects'', say), the clone the ssg-for-sdf repo:+change dirs to a folder that you keep projects in (''~/projects'', say), and clone the ssg-for-sdf repo:
   $git clone https://git.sdf.org/peteyboy/ssg-for-sdf.git   $git clone https://git.sdf.org/peteyboy/ssg-for-sdf.git
  
-===== Copy to your personal bid directory =====+===== Copy to your personal bin directory =====
   * Make sure you have a ~/bin folder.  If you don't already, make one: ''mkdir ~/bin'' (and add it to your $PATH)   * Make sure you have a ~/bin folder.  If you don't already, make one: ''mkdir ~/bin'' (and add it to your $PATH)
   * copy the ssg5 executable file to the ''bin'' folder, and make it executable by you   * copy the ssg5 executable file to the ''bin'' folder, and make it executable by you
Line 42: Line 43:
  
 ===== Set Up src and dest ===== ===== Set Up src and dest =====
-  * You can create a source folder, named whatever, let's say ''~/html_src''+  * You can create a source folder, named whatever, let's say ''~/html_source''
   * If you want to make sure things look right, you can make a destination folder that is not your ''~/html'' folder, you can make ''~/html_dest'' and simply delete the contents of ~/html and copy ~/html_dest into it when you are satisfied; alternately, you can just drop the results straight into your live //html// or //public_html// folder.   * If you want to make sure things look right, you can make a destination folder that is not your ''~/html'' folder, you can make ''~/html_dest'' and simply delete the contents of ~/html and copy ~/html_dest into it when you are satisfied; alternately, you can just drop the results straight into your live //html// or //public_html// folder.
  
Line 48: Line 49:
 If you want consistent headers or footers, just  If you want consistent headers or footers, just 
  
-  * If your site has or wants a favicon, put it as //favicon.png// in ''~/html_src'' +  * If your site has or wants a favicon, put it as //favicon.png// in ''~/html_source'' 
-  * Put something you want at the beginning of each file (css, <HEAD>, whatever) into ''~/html_src/_header.html'' +  * Put something you want at the beginning of each file (css, <HEAD>, whatever) into ''~/html_source/_header.html'' 
-  * Put something you want at the end of each file into ''~/html_src/_footer.html'' +    * At minimum, you want a HTML and title tag, the blank Title will get filled by H1 of your Markdown doc 
-  * Exclude any paths in  ''~/html_src/src/.ssgignore''+      * ''$ echo '<html><title></title><body>' > src/_header.html'' 
 +  * Put something you want at the end of each file into ''~/html_source/_footer.html'' 
 +    * At minimum, you want closing /BODY and /HTML tag 
 +      * ''$ echo '</body></html>' > ~/html_source/_footer.html ''  
 +  * Exclude any paths in  ''~/html_source/.ssgignore''
  
 ===== Put any existing HTML files into Source folder ===== ===== Put any existing HTML files into Source folder =====
-You can copy whatever you already have int ''~/html'' or ''~/public_html'' (for your tilde site), into your ''~/html_source'' folder+You can copy whatever you already have in ''~/html'' or ''~/public_html'' (for your tilde site), into your ''~/html_source'' folder
  
 ===== Start Writing Markdown ===== ===== Start Writing Markdown =====
-Ah, the easy part!  Just write your musings in any text editor using the [[ https://daringfireball.net/projects/markdown/syntax | Markdown Syntax]]+Ah, the easy part!  Just write your musings in any text editor using the [[ https://daringfireball.net/projects/markdown/syntax | Markdown Syntax]]. You don't need to have any HTML but either of the two optional "H1" markdown tags at the top of your markdown file if you want a title filled in using the ''_header.html'' file trick of making an empty <TITLE></TITLE> tag, as above: 
 + 
 +<code> 
 +My Title 
 +======= 
 +</code> 
 + 
 +or 
 + 
 +<code> 
 +# My title 
 +</code> 
  
 ===== Running SSG5 ===== ===== Running SSG5 =====
  
-If you just run ''ssg5'' it will give you its usage:+If you just run ''ssg5'' with no arguments it will give you its usage:
  
   $ ~/bin/ssg5   $ ~/bin/ssg5
Line 68: Line 85:
 Assuming you've added ''~/bin'' to your path, simply run something like: Assuming you've added ''~/bin'' to your path, simply run something like:
  
-  ssg5 ~/html_src ~/html_dst 'Test' 'https://<YOUR WEBSITE URL>'+  ssg5 ~/html_source ~/html_dest 'Test' 'https://<YOUR WEBSITE URL>'
    
  
-I use ''ssg5'' for my tilde pages, so I run:+If you used the minimal ''_header.html'' and ''_footer.html'' as described above, your page Titles will be of the form //Whatever the H1 is in your Markdown - The Title you fed to the ssg5 command//. It will appear in the generated HTML files in ''dest'' folder like so:  
 + 
 +<code> 
 +<html><title>This is my index file &mdash; Test</title> 
 +<h1>This is my index file</h1> 
 +... 
 +</code> 
 + 
 + 
 +I use the''ssg5'' tool for my tilde pages, so I run: 
 +''ssg5 ~/html_source ~/public_html "Peteyboy's tilde site" <nowiki>https://freeshell.org/~peteyboy</nowiki>''
  
- ssg5 ~/html_src ~/public_html "Peteyboy's tilde site" https://freeshell.org/~peteyboy+**After you generate your site, run ''mkhomepg -p'' to fix any permissions for new pages** 
 +  mkhomepg -p
  
 ===== Fancy Stuff ===== ===== Fancy Stuff =====
a_simple_static_site_generator.txt · Last modified: 2023/02/23 20:15 by peteyboy