BlendedSiteGenerator/Blended

Build problems with 4.1

jvromans opened this issue · 13 comments

Unfortunately, 4.1 yields errors:
Building your Blended files into a website!
Traceback (most recent call last): File "/bin/blended", line 11, in sys.exit(cli()) File "/usr/lib/python2.7/site-packages/click/core.py", line 722, in call return self.main(*args, **kwargs) File "/usr/lib/python2.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python2.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python2.7/site-packages/click/core.py", line 535, in invoke return callback(*args, **kwargs) File "/usr/lib/python2.7/site-packages/blended/main.py", line 547, in build build_files() File "/usr/lib/python2.7/site-packages/blended/main.py", line 469, in build_files file_modified = str(time.ctime(os.path.getmtime(subfolder_folder))) File "/usr/lib64/python2.7/genericpath.py", line 62, in getmtime return os.stat(filename).st_mtime OSError: [Errno 2] No such file or directory: '/home/jv/src/tt2site/Sites/JohanVromans/blended/build/foo/coloured_notes.html'

Note that there is no source content/foo/coloured_notes.html, so I wonder why it wants to put it in build.

Ok, I replicated your file structure and I was able to get it to work. Update Blended to test.

Now the problems get real...
In templates/header.html , there's .
This works in the top directory, but not in subdirectories.
If it were a real site, I can use href="/assets/css/main.css" (leading slash). But it's not, it's just the files in the build directory.
TT2Site can generate position independent file by using a variable site.top that expands to a relative path to the top directory. In blended terms,
href="{site_top}assets/css/main.css" would expand to "assets/css/main.css" in the top directory, to "../assets/css/main.css" in a subdirectory, to "../../assets ..." well, you get the idea.

Ok, I pushed as fix for that earlier today. You have to add {relative_root} before each path. for example, <link rel="stylesheet" href="{relative_root}assets/css/bootstrap.min.css"> converts to <link rel="stylesheet" href="../../assets/css/bootstrap.min.css">

Good job. Thanks.

Now, I would like to have the pages to have a different navigation bar. How to obtain that?

Create nav1.html and nav2.html and then in the home_page.html template put {nav1} and in the content_page.html template put {nav2}

Yes, that's what I do now. But using nav1 ... nav6 doesn't scale well.

Not really... And a bigger amount may quickly become unmaintainable.
My thoughts would go towards placing navXXX in the contents subfolders, next to the other documents. If a document has a navXXX next to it, use it, otherwise use the one from templates.

TT2Site uses .map files that reside in the contents folders and define all menu choices and targets for documents from this folder. The .map files are processed and combined before document generation, so the templates can use this info to produce all kinds of menus: nested, stacked, trail, navbar and so on.

For example (see http://johanvromans.nl):


title "Johan Vromans"
menu Projekten index.html#projekten
menu Contact contact

Note that if the target is not a file (e.g., "contact") it will use "contact.html" or "contact/index.html" whichever is present.

I hope you like it!