mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Add tutorial redirect
This commit is contained in:
parent
efedfcdfd5
commit
223704ee9c
@ -196,19 +196,9 @@ def build_single_page_version(lang, args, cfg):
|
||||
shutil.copytree(test_dir, args.save_raw_single_page)
|
||||
|
||||
|
||||
def build_redirect_html(args, from_path, to_path):
|
||||
for lang in args.lang.split(','):
|
||||
out_path = os.path.join(args.docs_output_dir, lang, from_path.replace('.md', '/index.html'))
|
||||
out_dir = os.path.dirname(out_path)
|
||||
try:
|
||||
os.makedirs(out_dir)
|
||||
except OSError:
|
||||
pass
|
||||
version_prefix = args.version_prefix + '/' if args.version_prefix else '/'
|
||||
to_url = '/docs%s%s/%s' % (version_prefix, lang, to_path.replace('.md', '/'))
|
||||
to_url = to_url.strip()
|
||||
with open(out_path, 'w') as f:
|
||||
f.write('''<!DOCTYPE HTML>
|
||||
def write_redirect_html(out_path, to_url):
|
||||
with open(out_path, 'w') as f:
|
||||
f.write('''<!DOCTYPE HTML>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
@ -224,6 +214,20 @@ def build_redirect_html(args, from_path, to_path):
|
||||
</html>''' % (to_url, to_url, to_url))
|
||||
|
||||
|
||||
def build_redirect_html(args, from_path, to_path):
|
||||
for lang in args.lang.split(','):
|
||||
out_path = os.path.join(args.docs_output_dir, lang, from_path.replace('.md', '/index.html'))
|
||||
out_dir = os.path.dirname(out_path)
|
||||
try:
|
||||
os.makedirs(out_dir)
|
||||
except OSError:
|
||||
pass
|
||||
version_prefix = args.version_prefix + '/' if args.version_prefix else '/'
|
||||
to_url = '/docs%s%s/%s' % (version_prefix, lang, to_path.replace('.md', '/'))
|
||||
to_url = to_url.strip()
|
||||
write_redirect_html(out_path, to_url)
|
||||
|
||||
|
||||
def build_redirects(args):
|
||||
lang_re_fragment = args.lang.replace(',', '|')
|
||||
rewrites = []
|
||||
@ -263,6 +267,11 @@ def build(args):
|
||||
if not args.skip_website:
|
||||
minify_website(args)
|
||||
|
||||
write_redirect_html(
|
||||
os.path.join(args.output_dir, 'tutorial.html'),
|
||||
'/docs/en/getting_started/tutorial/'
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.chdir(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
Loading…
Reference in New Issue
Block a user