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
a_simple_static_site_generator [2021/03/15 08:33] – [Start Writing Markdown] clarify title peteyboya_simple_static_site_generator [2023/02/23 20:15] (current) – added explanation 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''
     * At minimum, you want a HTML and title tag, the blank Title will get filled by H1 of your Markdown doc     * At minimum, you want a HTML and title tag, the blank Title will get filled by H1 of your Markdown doc
       * ''$ echo '<html><title></title><body>' > src/_header.html''       * ''$ echo '<html><title></title><body>' > src/_header.html''
-  * Put something you want at the end of each file into ''~/html_src/_footer.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     * At minimum, you want closing /BODY and /HTML tag
-      * ''$ echo '</body></html>'src/_footer.html ''  +      * ''$ echo '</body></html>'~/html_source/_footer.html ''  
-  * Exclude any paths in  ''~/html_src/src/.ssgignore''+  * 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 =====
Line 77: Line 78:
 ===== Running SSG5 ===== ===== Running SSG5 =====
  
-If you just run ''ssg5'' with no arguments and 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 84: 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>'
    
  
-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//like so: +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 ''html_dest'' folder (using the example ssg5 command above) like so: 
  
 <code> <code>
Line 96: Line 97:
  
  
-I use ''ssg5'' for my tilde pages, so I run: +I use the''ssg5'' tool for my tilde pages, so I run: 
-''ssg5 ~/html_src ~/public_html "Peteyboy's tilde site" <nowiki>https://freeshell.org/~peteyboy</nowiki>''+''ssg5 ~/html_source ~/public_html "Peteyboy's tilde site" <nowiki>https://freeshell.org/~peteyboy</nowiki>''
  
 **After you generate your site, run ''mkhomepg -p'' to fix any permissions for new pages** **After you generate your site, run ''mkhomepg -p'' to fix any permissions for new pages**
a_simple_static_site_generator.1615797213.txt.gz · Last modified: 2021/03/15 08:33 by peteyboy