Skip to content

Commit eec2480

Browse files
committed
adding metadata, and testing changing urls in files (gulp)
1 parent 9f8644a commit eec2480

3 files changed

Lines changed: 25 additions & 7 deletions

File tree

_includes/head.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<meta charset="utf-8">
22
<meta http-equiv="X-UA-Compatible" content="IE=edge">
33
<meta name="viewport" content="width=device-width, initial-scale=1">
4-
<meta name="description" content="{% if page.summary %}{{ page.summary | strip_html | strip_newlines | truncate: 160 }}{% endif %}">
5-
<meta name="keywords" content="{{page.tags}}{% if page.tags %}, {% endif %} {{page.keywords}}">
4+
5+
{% include metadata.html %}
6+
67
<title>{{ page.title }} | {{ site.site_title }}</title>
78
<link rel="stylesheet" href="{{ "assets/css/syntax.css" }}">
89

_includes/metadata.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<meta name="description" content="{% if page.summary %}{{ page.summary | strip_html | strip_newlines }}{% endif %}">
2+
<meta name="keywords" content="{{page.tags}}{% if page.tags %}, {% endif %} {{page.keywords}}">
3+
{% if page.title %}
4+
<meta name="name" content="{{ image.name }}">
5+
{% endif %}
6+
<meta name="thumbnail" content="http://singularity.lbl.gov/images/logo/logo.svg">
7+
{% if page.targz %}
8+
<meta name="file" content="{{ site.repo }}/archive/{{ page.targz }}">
9+
{% endif %}
10+
{% if page.version %}
11+
<meta name="file" content="{{ site.repo }}/releases/download/{{ page.version }}/singularity-{{ page.version }}.tar.gz">
12+
{% endif %}

circle_urls.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,20 @@
55
'''
66
import sys
77
import os
8-
import re
98
from glob import glob
109

1110
site_dir = os.path.abspath(sys.argv[1])
1211
print("Using site directory %s" %(site_dir))
1312

1413
files = glob("%s/*.html" %(site_dir))
14+
15+
# For each file, we need to replace all links to have correct .html extension
16+
search_names = [os.path.basename(f) for f in files]
17+
1518
for html_file in files:
16-
if not html_file.endswith('index.html'):
17-
new_name = html_file.replace('.html','')
18-
print("Renaming %s to %s." %(html_file,new_name))
19-
os.rename(html_file, new_name)
19+
with open(html_file,'r') as filey:
20+
content = filey.read()
21+
for search_name in search_names:
22+
content = content.replace('/%s"' %(search_name),'/%s.html"' %(search_name))
23+
with open(html_file,'w' as filey:
24+
filey.write(content)

0 commit comments

Comments
 (0)