diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py
index 8e321b3..df1758f 100644
--- a/src/var/lib/tyto/program/check.py
+++ b/src/var/lib/tyto/program/check.py
@@ -66,7 +66,7 @@ def post_IDs(file_post):
# Set HTML file from file_post
file_html = file_post.replace('.tyto','.html')
if file_html.endswith('index.html'):
- file_html = file_html.remplace('index.html', '')
+ file_html = file_html.replace('index.html', '')
# Complete URL post file
global post_url
diff --git a/src/var/lib/tyto/program/html.py b/src/var/lib/tyto/program/html.py
index 807dcfc..4638c06 100644
--- a/src/var/lib/tyto/program/html.py
+++ b/src/var/lib/tyto/program/html.py
@@ -196,7 +196,7 @@ def html_main_page(wip_html):
'
\n'%domain.domain_sdb_title + \
' \n' + \
- ' \n' + \
+ '\n' + \
'
\n' + \
' \n' + \
' \n' + \
diff --git a/src/var/lib/tyto/program/sidebar.py b/src/var/lib/tyto/program/sidebar.py
index a6fc77a..e17cfb9 100644
--- a/src/var/lib/tyto/program/sidebar.py
+++ b/src/var/lib/tyto/program/sidebar.py
@@ -82,18 +82,23 @@ def loop_sidebar(create):
msg_log = 'Sidebar > Not created. Mismatch some article\'s URI'
log.append_f(domain.tyto_logs, msg_log, 1)
else:
+
+ print('>', sdb_posts, posts_uri)
+
# Create sidebar.html
file = open(sidebar_file, 'w')
file.close()
- for item, post in sdb_posts, posts_uri:
+ i = 0
+ for item in sdb_posts:
db_article = '%s%s.conf'%(domain.domain_db, item)
if os.path.exists(db_article):
- print("OK for",item, post)
+ print("OK for",item, posts_uri[i])
create_sdb_item(db_article)
else:
- msg_log = 'Sidebar > Article not yet ready: %s'%post
+ msg_log = 'Sidebar > Article not yet ready: %s'%posts_uri[i]
log.append_f(domain.tyto_logs, msg_log, 1)
+ i += 1
#==========================================#
@@ -142,7 +147,7 @@ def create_sdb_item(db_article):
with open(sidebar_file, 'a') as file:
for line in sdb_html_item.rsplit('\n'):
- file.write('%s%s\n'%(8*' ', line))
+ file.write('%s%s\n'%(16*' ', line))
diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py
index 9b2f3f5..911725e 100644
--- a/src/var/lib/tyto/program/wip.py
+++ b/src/var/lib/tyto/program/wip.py
@@ -121,11 +121,16 @@ def manage_wip(file_post, Force):
print('> Article HTML:\n', wip_html)
# Create file to wip srv (replace file, if exists)
- wip_file = '%s%s'%(domain.srv_wip, file_post.replace('.tyto','.html'))
+ wip_file = file_post.replace('.tyto','.html')
+ wip_uri = '%s%s'%(domain.srv_wip, wip_file)
+ wip_dir = wip_uri.replace(os.path.basename(wip_uri), '')
if os.path.exists(wip_file):
os.remove(wip_file)
- page_file = open(wip_file, 'w')
+ # Create sub folder if needed
+ os.makedirs(wip_dir, exist_ok=True)
+
+ page_file = open(wip_uri, 'w')
page_file.write(wip_html)
page_file.close()