Skip to content

Commit

Permalink
local setup complete
Browse files Browse the repository at this point in the history
  • Loading branch information
rlanzafame committed Oct 13, 2024
0 parents commit 16b274a
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output/
__pycache__/
cache/
80 changes: 80 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
PY?=
PELICAN?=pelican
PELICANOPTS=

BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/content
OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py

GITHUB_PAGES_BRANCH=main
GITHUB_PAGES_COMMIT_MESSAGE=Generate Pelican site


DEBUG ?= 0
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif

RELATIVE ?= 0
ifeq ($(RELATIVE), 1)
PELICANOPTS += --relative-urls
endif

SERVER ?= "0.0.0.0"

PORT ?= 0
ifneq ($(PORT), 0)
PELICANOPTS += -p $(PORT)
endif


help:
@echo 'Makefile for a pelican Web site '
@echo ' '
@echo 'Usage: '
@echo ' make html (re)generate the web site '
@echo ' make clean remove the generated files '
@echo ' make regenerate regenerate files upon modification '
@echo ' make publish generate using production settings '
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
@echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
@echo ' make devserver [PORT=8000] serve and regenerate together '
@echo ' make devserver-global regenerate and serve on 0.0.0.0 '
@echo ' make github upload the web site via gh-pages '
@echo ' '
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
@echo 'Set the RELATIVE variable to 1 to enable relative urls '
@echo ' '

html:
"$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)

clean:
[ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)"

regenerate:
"$(PELICAN)" -r "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)

serve:
"$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)

serve-global:
"$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER)

devserver:
"$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)

devserver-global:
"$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b 0.0.0.0

publish:
"$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(PUBLISHCONF)" $(PELICANOPTS)

github: publish
ghp-import -m "$(GITHUB_PAGES_COMMIT_MESSAGE)" -b $(GITHUB_PAGES_BRANCH) "$(OUTPUTDIR)" --no-jekyll
git push origin $(GITHUB_PAGES_BRANCH)


.PHONY: html help clean regenerate serve serve-global devserver devserver-global publish github
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Source files for Robert Lanzafame's Personal Website

Started October, 2024. Content will come later.

Borrowing liberally from Jason Moore's websites like this one: [github.com/mechmotum/mechmotum.github.io](https://github.com/mechmotum/mechmotum.github.io).

Setup notes:
- started with Jason's `env.yml` file
- used Pelican's quickstart method
- copied Jason's config file
- forked [Jason's template repo](https://github.com/mechmotum/pelican-alchemy) ([my repo](https://github.com/rlanzafame/pelican-alchemy))
- created an assets repo to keep images out of this one
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
THEME_PATH: C:\Users\rlanzafame\code\pelican\pelican-alchemy\alchemy
PLUGIN_PATHS: C:\Users\rlanzafame\code\pelican\pelican-plugins
11 changes: 11 additions & 0 deletions content/articles/first.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
First Post
==========

:date: 2024-10-13 08:00
:tags: none
:category: none
:slug: first-post
:authors: Robert Lanzafame
:summary: First post.

This is the first post...
21 changes: 21 additions & 0 deletions content/pages/about.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
=====
About
=====

:url:
:save_as: index.html
:sortorder: 0
:date: 2024-10-13
:front: true

I am currently a Senior Lecturer at Delft University of Technology in the
Netherlands. This website will collect...stuff.

Thanks to Jason Moore for the `template`_, and so many other great ideas
related to education, open source tools and much more.

This website is built in `this repository`_ and uses material liberally from Jason's repo `here`_.

.. _template: https://mechmotum.github.io/
.. _this repository: https://github.com/rlanzafame/rlanzafame.github.io
.. _here: https://github.com/mechmotum/mechmotum.github.io
10 changes: 10 additions & 0 deletions content/pages/contact.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
=======
Contact
=======

:sortorder: 6

Email
=====

Contact Robert at [email protected] or [email protected]
9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: pelican
channels:
- conda-forge
dependencies:
- beautifulsoup4
- invoke
- livereload
- pelican
- pyyaml
87 changes: 87 additions & 0 deletions pelicanconf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Borrowing heavily from Jason Moore's site:
# https://github.com/mechmotum/mechmotum.github.io/

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

import os
import yaml

AUTHOR = 'Robert Lanzafame'
SITENAME = 'Robert Lanzafame'
SITEURL = ""
SOURCEURL = 'https://github.com/rlanzafame/rlanzafame.github.io'

PATH = "content"
TIMEZONE = 'Europe/Rome'
DEFAULT_LANG = 'en'

## Jason Moore's settings

# This sets the default pages to be top level items and articles to be under
# /blog/.
INDEX_SAVE_AS = 'blog/index.html'

# All blog posts will have slugs that match the file name.
PATH_METADATA = '(?P<path_no_ext>.*)\..*' # regex to grab file name without ext
ARTICLE_URL = 'blog/{path_no_ext}.html'
ARTICLE_SAVE_AS = 'blog/{path_no_ext}.html'

PAGE_URL = '{slug}.html'
PAGE_SAVE_AS = '{slug}.html'
PAGE_ORDER_BY = 'sortorder'

MENUITEMS = [('Blog', '/blog/')]

## Pelican initialization settings
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None

# Blogroll
LINKS = ()

# Social widget
SOCIAL = ()

DEFAULT_PAGINATION = False

## More of Jason Moore's settings
try:
with open('config.yml', 'r') as config_file:
config_data = yaml.load(config_file, Loader=yaml.FullLoader)
except IOError:
THEME = ''
PLUGIN_PATHS = ['']
else:
THEME = config_data['THEME_PATH']
PLUGIN_PATHS = config_data['PLUGIN_PATHS']
if isinstance(PLUGIN_PATHS, type('')):
PLUGIN_PATHS = [PLUGIN_PATHS]
print(THEME, PLUGIN_PATHS)
## THEME

# Alchemy theme settings
OS_SEP = os.sep
# DISQUS_SITENAME = "blank"
SITESUBTITLE = 'Personal Website'
SITEIMAGE = 'https://rlanzafame.github.io/assets/images/sailboat-sloop.svg'
# INSTITUTEIMAGE should bee 100px in height
INSTITUTIONIMAGE = 'https://rlanzafame.github.io/assets/logos/tud-233x100.png'
DESCRIPTION = ''
# pelican-alchemy removed the original theme.css, so bring it back.
THEME_CSS_OVERRIDES = ['theme/css/origtheme.css']
REPO_URL = 'https://github.com/rlanzafame/rlanzafame.github.io'
# TODO : Fix the template so that if this isn't declared it still builds.
EXCLUDED_CATEGORIES = []

#GOOGLE_ANALYTICS = ''
#DISQUS_SITENAME = ''

## PLUGINS

PLUGINS = ['render_math', 'extract_toc']
29 changes: 29 additions & 0 deletions publishconf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Borrowing heavily from Jason Moore's site:
# https://github.com/mechmotum/mechmotum.github.io/

# This file is only used if you use `make publish` or
# explicitly specify it as your config file.

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals # from Jason Moore's site

import os
import sys

sys.path.append(os.curdir)
from pelicanconf import *

# If your site is available via HTTPS, make sure SITEURL begins with https://
SITEURL = "https://rlanzafame.github.io"
RELATIVE_URLS = False

FEED_ALL_ATOM = "feeds/all.atom.xml"
CATEGORY_FEED_ATOM = "feeds/{slug}.atom.xml"

DELETE_OUTPUT_DIRECTORY = True

# Following items are often useful when publishing

# DISQUS_SITENAME = ""
# GOOGLE_ANALYTICS = ""
Loading

0 comments on commit 16b274a

Please sign in to comment.