#! /usr/bin/ruby3.0 require 'sinatra' require 'erb' require 'date' class Page String @path @date def initialize(path, date) @path = path @date = date end def setpath(path) @path = path end def setdate(date) @date = date end def getpath return @path end def getdate return @date end end get '/' do erb :greetpage end get '/home' do erb :homepage end get '/media' do erb :folderpage end get '/media/' do erb :folderpage end get '/media/*' do erb :blogpage end get '/technology' do erb :folderpage end get '/technology/' do erb :folderpage end get '/technology/*' do erb :blogpage end get '/news' do erb :folderpage end get '/news/' do erb :folderpage end get '/news/*' do erb :blogpage end get '/search' do erb :searchpage, locals: {folder: "all", searchquery: ""} end get '/search/' do erb :searchpage, locals: {folder: "all", searchquery: ""} end get '/search/:folder' do erb :searchpage, locals: {folder: params["folder"].downcase, searchquery: params["search"]} end get '/about' do erb :aboutpage end get '/contact' do erb :contactpage end not_found do status 404 erb :oops end