Getting on
Got hooked? If you fancy your own GitHub webpage that allows you to programme Python in the browser, we’ve got something for you:
- Get your GitHub account at https://github.com/
- Go to https://github.com/Durham-Hackathon/template-website
- In the upper right corner, click on
fork - In the forked repo, go to
Settings→Pages - Change the
Source:None→gh-pages→save - Your website will now be built. You may need to wait for a while for it to be available.
- Click on the link at the top of the
Settingspage to visit your webpage. - In case your website is not yet deployed, you may want to check for error messages by clicking on Actions and expanding.
In order to edit the content on your webpage or to persist your code:
- Write and test your code in the browser
- Go to your fork of the template-website
- Click on
index.mdto open it - In the upper right corner, click on the pen to edit the file
- To persist your code, add it between the HTML tags of the textarea
id=yourcode - On the bottom of the page, click
Commit changes - Wait for the website to be generated
To change the content of your webpage, you should only need to change and add Markdown files, meaning, the files with an .md ending. You can change the title and description of the website in the .yml configuration file, please make further changes only if you know what you are doing :-)
Fancy different themes and colours? The Jekyll documentation will teach you how to do that.
This short tutorial on github markdown will teach you how to write new content, e.g. to add pictures.
This theme is called architect, you can find configuration options for it here.
Running outside of the browser
You may also want to install python and run these files outside of the browser. In this case whenever you close the turtle window you will crash your code. So perhaps add:
def on_close():
global running
running = False
window.getcanvas().winfo_toplevel().protocol("WM_DELETE_WINDOW", on_close)
And instead of running a loop while True run
running = False
while running:
# Your code here