-
Fork the repo
-
Clone your forked repo
git clone https://github.com/{username}/flaskcwg.github.io.git cd flaskcwg.github.io
-
Setup the upstream to original repo
git remote add upstream https://github.com/flaskcwg/flaskcwg.github.io.git
-
Create a virtual environment and activate it
For Linux/Mac:
python -m venv env source env/bin/activate # The following also works: `. env/bin/activate`
For Windows:
py -m venv env env\Scripts\activate.bat # if using command prompt # if using bash in windows, you can also do `source env/Scripts/activate`
-
install dependencies
python -m pip install -r requirements.txt
-
run
static.py
. This will build html content indocs/
.python static.py
NOTE: If you want the files to auto regenerate on changes, run
python static.py --server
instead. -
run
serve.py
as shown below. Go to the IP address shown in the printout to view the generated site.cd docs python serve.py
-
To see changes made in
/templates
reflect on the generated site, runpython static.py
again in separate terminal (not needed if you ranpython static.py --server
) and refresh the url.
PRs are made to source branch. The source branch is automatically extrapolated to the main branch where gh-pages is deployed
In static.py
, under generate, add another generate function:
def main(args):
def gen():
generate('index.html', join(settings.OUTPUT_FOLDER, 'index.html'), **context)
Like this:
def main(args):
def gen():
generate('index.html', join(settings.OUTPUT_FOLDER, 'index.html'), **context)
generate('source_file.html', join(settings.OUTPUT_FOLDER, 'output_file.html'), **context)
Where source_file.html
is the name of the file located in templates/
and output_file.html
is the output file which will be located in docs/
.
jamstack: Generate pages using Jinja templates.
flask + livereload: If you want to auto regenerate files without executing static.py
.
In info.json, a profile looks like this
"greyli":{
"name": "Grey Li",
"bio": [],
"volunteer": {
"translation":{
"lang": "chinese",
"coordinator": "y"
},
"event": {},
"code": {},
"education": {}
},
"links":{
"twitter": ""
},
"retired": "n"
},
- name
- volunteer
Looks for four optional keys: translation, event, code, education. For translation, you have lang and coordinator, the latter being optional
- bio
The bio is generated such that ''
are converted into <br\>
. a bio would look like this:
"bio": [
"Line iwue hfowherf oewrhfje.",
"woihfjerewoi tgfreh eroh gfrehre greh g.",
"", "",
"Some more lines"],
-
links are generated as links with text as the key and link as the value
-
retired
if someomne is active or not
A blog post occurs in the format:
title: Demo blog post
summary: A demo post
authors: jugmac00
Abdur-RahmaanJ
date: May 19, 2021
slug: demo-blog-post
This is the first paragraph of the document.
```python
def x():
pass
```
And hence [link demo](https://flaskcwg.github.io)
All meta keys are mandatory but summary can be kept empty
Inside of data/blog create a folder with the category you want. In settings.py add it
BLOG_CATEGORIES = [
'main'
]
For authors, the author must occur in profiles.
{
"name": "Flask-Dance",
"link": "https://github.com/singingwolfboy/flask-dance",
"info": ["Doing the OAuth dance with style using Flask, requests, and oauthlib."],
"tags": ["auth", "oauth"]
}
In data/faq, create a .md file with whatever name you want .md
The content should look like this
title: Demo faq question
tags: demo
flask
lol
slug: demo-faq-question
This is the first paragraph of the document.
```python
def x():
pass
```
And hence [link demo](https://flaskcwg.github.io)