Code Monkey home page Code Monkey logo

static-site-generator-pclub's Introduction

Static-Site-Generator-Pclub

python-logo jinja github-actions-badge github-pages-badge markdown-logo

Description

This Static site generator is written in python . It takes content and user details directory as input and creates static site in the output directory. It reads the blogs in content folder in markdown format and convert it to the html then there is magic of jinja library by which we insert every blog metadata to index file. we have other pages also like about and contact we take markdown from user detail folder and create the pages. There also a cool tag feature which shows blog of specific tag. There is RSS feed.

Usage

Blog posting

Put your all blog files in markdown format in content folder . There have format for example :

  • title: Life at IITK
  • date: 2023-06-19 6:43
  • slug: first-year-experience
  • summary: how my life going in iitk , how was MTH
  • tag: experience college

After that you can put your blog content in markdown format .

About and Contact

In User-details folder you can edit in about.md the Name , Age , Branch , Hobbies. then after that you can give the brief description that it takes to introduce yourself. You can input your contact details in contact.md . their is email , github , facebook , instagram and twitter . After that you can put any text you want.

After putting all content you can run generator.py . It will give you output in output folder .

Setup

Install the virtualenv if you dont have

pip install virtual venv

Create the virtual env

virtual venv

Activate the virtual venv

  • For Windows:
.\venv\Scripts\activate
  • For Ubunto/mac:
source venv/bin/activate

Install the Basic requirements

pip install -r requirements.txt

Input all the Blog files in the content folder and edit the files inside the user-details for about and contact page.

Then build the site

python generator.py

You will get your website at output folder .

Github Pages

I have hosted the repo output to gh-pages there is a workflow.

name: Deploy to GitHub Pages

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Setting up Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.9'
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Installing dependencies
        run: pip install -r ./requirements.txt

      - name: Build site
        run: python generator.py
        
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          personal_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: ./output

Features

Tagging

There are tags which can be used to filter out specific tagged Blogs.

Generating Multiple Blog at once.

You can generate multiple blogs just put all blogs files in content folder.

static-site-generator-pclub's People

Contributors

royalgamr avatar

Watchers

 avatar

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.