spanezz / staticsite

Static site generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ssite show crash if already builded

erossi opened this issue · comments

Following the 1st example for blog creations if I do:

apt install --install-recommends /srv/scratch/Downloads/staticsite_2.2-1_all.deb
mkdir ssite
cd ssite
edit index.md
ssite build -o built_site
ssite show
Traceback (most recent call last):
File "/usr/bin/ssite", line 33, in
sys.exit(main())
File "/usr/bin/ssite", line 27, in main
return handler.run()
File "/usr/lib/python3/dist-packages/staticsite/cmd/serve/init.py", line 58, in run
self.start_server()
File "/usr/lib/python3/dist-packages/staticsite/cmd/serve/init.py", line 41, in start_server
app.reload()
File "/usr/lib/python3/dist-packages/staticsite/cmd/serve/server.py", line 176, in reload
self.site.load()
File "/usr/lib/python3/dist-packages/staticsite/site.py", line 523, in load
self._crossreference()
File "/usr/lib/python3/dist-packages/staticsite/site.py", line 556, in _crossreference
feature.crossreference()
File "/usr/lib/python3/dist-packages/staticsite/features/images.py", line 232, in crossreference
if not page.image and basename_no_ext(page.src.relpath) == name:
AttributeError: 'Asset' object has no attribute 'image'

if I remove the built_site directory instead it works.

Thanks for the issue! I think I have three issues here:

  1. the tutorial writes the built site inside the content directory
  2. the built directory is interpreted as content
  3. an unneeded optimization that causes a crash related to assets in source directories

I could leave 1, if I marked the built site as such and skipped it when reading contents (2), and meanwhile use this as a test case to fix 3