Git Product home page Git Product logo

franceme.github.io's Introduction

Base Website

Helpful Items

  1. The index.html page is the main and only webpage
  2. The setup.py provides any variables and methods used within the html webpage
    1. index.html uses Jinja internally to process the website
  3. Think of the process similar to compilation
    1. Index is the raw source code
    2. Python (setup.py) compiles the index.html webpage into the usable format
    3. Python (setup.py) returns the useable index.html, with all the information sent in as a live dynamic website

However GitHub Actions and GitHub Pages only uses Static Pages. The Python package Frozen-Flask is able to freeze the dynamic website to static webpages. Essentially the usable index.html file produced by Python (setup.py) gets frozen to a static website. Methods and variables are transferred from python to html listed below.

Methods

def get_base():
    .
    .
    .
    return flask.render_template_string(f"""TA DA""")

app.jinja_env.filters['get_base'] = get_base

Variables

@app.route('/index.html')
def index():
    .
    .
    .
    return render_template_string(get_file(page),mimetype="text/html",variable_one="variable_one")

There are a few cavietes that need to be handled:

  1. Redirects cannot be handled using regular flask methods since the dynamic page gets translated to a static webpage. However a static html that redirects is a working redirect that I use. The code is listed below.
<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="0; url={url}">
        <script type="text/javascript">
             window.location.href = "{url}"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        If you are not redirected automatically, follow this <a href='{url}'>link to example</a>.
    </body>
</html>
  1. The website is completely static, no dynamic handling or webpage redirecting.

franceme.github.io's People

Contributors

franceme avatar

Watchers

 avatar  avatar

Forkers

frank-gbadago

franceme.github.io's Issues

Sefl Plug

  • Change the wording for working and exciting

GTA

  • Add Course Names
  • hyperlink Cryptoguard

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.