Last active
June 14, 2019 13:22
-
-
Save vsoch/9d1e6253740e67f6c9cc00e062f0d435 to your computer and use it in GitHub Desktop.
Data.json served at https://github.com/USRSE/community-template/blob/master/pages/data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: null | |
excluded_in_search: true | |
permalink: /data.json | |
--- | |
{ | |
{% for post in site.pages %}{% unless post.excluded_in_search %}{% if added %},{% endif %}{% assign added = false %} | |
"{{ site.title | slugify }}-{{ post.url | slugify }}": { | |
"id": "{{ site.title | slugify }}-{{ post.url | slugify }}", | |
"title": "{{ site.title }}: {{ post.title | xml_escape }}", | |
"categories": "{{ site.github_username }},{{ site.institution }},{{ post.categories | join: ", " | xml_escape }}", | |
"url": "{{ site.baseurl }}{{ post.url | xml_escape }}", | |
"content": {{ post.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }} | |
}{% assign added = true %}{% endunless %}{% endfor %}{% for post in site.people %}{% unless post.excluded_in_search %}{% if added %},{% endif %}{% assign added = false %} | |
"{{ site.title | slugify }}-{{ post.url | slugify }}": { | |
"id": "{{ site.title | slugify }}-{{ post.url | slugify }}", | |
"title": "{{ site.title }}: {{ post.name }} - {{ post.title | xml_escape }}", | |
"categories": "{{ site.github_username }},{{ site.institution }},{{ post.categories | join: ", " | xml_escape }}", | |
"url": "{{ site.baseurl }}{{ post.url | xml_escape }}", | |
"content": {{ post.content | strip_html | replace_regex: "[\s/\n]+"," " | strip | jsonify }} | |
}{% assign added = true %}{% endunless %}{% endfor %} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: home | |
permalink: / | |
--- | |
<!-- This template discovers and parses the data.json files from the GitHub Organization --> | |
<!-- https://github.com/USRSE/find-an-rse/blob/master/pages/index.md--> | |
## Find a Research Software Engineer | |
<form action="{{ site.baseurl }}/" method="get"> | |
<input type="search" name="q" id="search-input" placeholder="Find an RSE?" style="margin-top:5px" autofocus> | |
<input type="submit" value="Search" style="display: none;"> | |
</form> | |
<p><span id="search-process">Loading</span> results <span id="search-query-container" style="display: none;">for "<strong id="search-query"></strong>"</span></p> | |
<ul id="search-results"></ul> | |
<script src="{{ site.baseurl }}/assets/js/lunr.min.js"></script> | |
<script src="{{ site.baseurl }}/assets/vendor/jquery/jquery.min.js" ></script> | |
<script> | |
(function() { | |
window.data = {} | |
$.getJSON("https://api.github.com/orgs/{{ site.github_username }}/repos", { | |
format: "json" | |
}).done(function(data) { | |
console.log("Found repos starting with {{ site.prefix }}:") | |
$.each(data, function(key, value) { | |
if (value.name.startsWith("{{ site.prefix }}")) { | |
console.log(value.name); | |
var dataurl = "{{ site.domain }}/" + value.name + '/data.json' | |
console.log(dataurl) | |
$.getJSON(dataurl, { | |
format: "json" | |
}).done(function(pages, status) { | |
if (status == "success") { | |
$.each(pages, function(key, value) { | |
window.data[key] = value; | |
}); | |
} | |
}); | |
} | |
}) | |
}); | |
function loadSearch() { | |
console.log(window.data) | |
var fileref = document.createElement('script') | |
fileref.setAttribute("type","text/javascript") | |
fileref.setAttribute("src", "{{ site.baseurl }}/assets/js/search.js") | |
document.getElementsByTagName("head")[0].appendChild(fileref) | |
} | |
setTimeout(loadSearch, 1000); | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment