Package: website-generator
Website GeneratorA minimalistic static website generatorFeatures:Ease of useMarkdown support- Markdown can be used as an alternative to htmlBloggingTagsRSSSmall code base- Easy to get an overview of what the program does (all code is contained in the./main.pyfile)Themes- customize one of the included ones or create your own from scratchEasy to create your own themesTarget groups:Non-tech-savvy people or small groups that want a simple and secure website or blogIf you want to create custom themes, html knowledge is needed, but for the content markdown can be usedBasic knowledge of using a terminal window (command line) is requiredMore tech-savvy people who want full control over the application (and perhaps want to customize the Python code)Why a static website instead of something like WordPress?Less underlying software to maintainEasy access to the codeFasterSaferWhy this static website generator instead of pure html?You can have multiple pages and get the same look for all without having to copy and paste each time a change is made for the lookVery easy to change the theme of the website (and keep the content)Markdown supports enables you to create a website without needing to code htmlInstalling (and Starting)UbuntuInstall using pipRequires Python 3.9. You can see the python version by typingpython3 --version(on Linux-based systems) orpython --version(on Windows and MacOS)pip3 install website-generator(Optional)echo 'export PATH="$HOME/.local/bin:$PATH"' >> .bashrc, and thensource .bashrcThen start with:website-genRunning from binaryTODORunning from sourceDownload the source files (tar.gz/zip) or clone, and then unzipcd into the directory and runpython3 main.pyWindowsInstall using pipDownload and install Python 3.x (Windows 7 supports up to 3.8, but not higher, so if you are using Windows 7 please make sure to download the 3.8 version rather than the latest)pip install website-generatorStart using this file: {python-install-dir}/Scripts/website-genRunning from binaryTODORunning from sourceDownload the source files (tar.gz/zip) or clone, and then unzipcd into the directory and runpython main.pyMacOSTODO(More or less the same as for Ubuntu above)UsageQuick startSimply run the application (as described above under "Installation"). Example content files are in place already, and a default theme will be used. The website will be generated and placed in theoutputfolder (default ispublic). Then the local website files will be loaded in your browser!Parameters that can be given to the applicationcontent-dirtheme-diroutput-dirforce-remove-outputcontent-urlwebsite-urlWith the-hflag you can get a description of all of theseThe application supports using asettings.inifile, which can be used to store commonly used values of these parameters (so that you don't have to give them every time at the command line)Adding new contentAdd.htmland/or.mdfiles - with the content you want - into thecontentdira theme template file will be used as a "frame" for your content. This template usually includes things like a header, footer and a css-file (for styling, layout, colors, fonts, etc.)(Optional) If you are using any images or other resource files, add these to the./contentdir. All files and dirs - except.htmland.mdfiles - will be copiedif you want to separate the resource files you can create a sub-directory starting with underscore, for example_imgor_res, and then reference these files using relative links (markdown example:![image-description](_img/my-image.png))Creating a blog and adding blogs and postsThis works in the same way as above, with these exceptions/additions:All the contents of the blog is placed in a sub-directory to thecontentdirectoryEach blog post will be given a date, which will be displayed and will be used to sort the postsYou can add a date at the start of the file name, ex:2000-01-01_my_blog_post.mdIf no date is provided in the name of the file, then the application will read the modification time of the file and use that insteadBlog posts can havetags, they are added by writing the name of the tag at the end of the file name, but before the suffix. For example:my_blog_post[loving-kindness].md. It's possible to have several tags for one postDirectories and files./main.pyfileThe main file which is used to start the application and contains all the Python code./themes/dirThis is the location of the different themes that comes packaged with the application. Using the--theme-dirvariable you can use a theme from a different directory than this one[theme-dir]/template.htmlfileThis file contains the template (or "frame") for each page on the websiteIn the middle there is a space for inserting code from the files in the./contentdirectory[theme-dir]/style.cssfileCSS file used in the template (so it will be used globally for all output/public files)contentdirTODO.htmland.mdfilesThe content that will be placed inside the templateSupports markdown and htmlHtml is simply copied into the template. Markdown is transformed to htmlPlease remember to have one file namedindex.htmlorindex.md. This will be used as the home/front pageOther files and dirsThese are resource files, for example image files, that will be copied into the./publicdirectoryOutput (default:public) dirAn output directory where the resulting files and will be placedCreating a themeCopy the contents of one of the theme directories under./themes/(for example./themes/clean) into a new directory to create a base for your own themeModify the[your-theme-dir]/template.htmlfile by adding/modifying header and footer contentModify the[your-theme-dir]/style.cssfileThe website generator works by replacing variables inside the template with html for different pages on the website. The most important variable is${content}since this will be the place where (different) content is inserted for each page.Template variablescontent-dir- This is the most important variable (discussed above------)navigation- This will automatically be generated from the list of files in the content dir, so that there is a link to each of the pages created for the websiteHosting on GitLabNormally the application is meant to be run locally but using a CI/CD system like gitlab you can trigger a job which generates/builds your website.Please seethis directoryfor a group of files which you can copy to your own gitlab website repo.Once you have the files in place, and a change is made in the repo, the.gitlab-ci.ymlfile is used by the gitlab servers to automatically generate the output html.