Skip to content

Commit

Permalink
nav link animation, serverless function test (deepset-ai#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgauci committed Sep 22, 2022
1 parent af81109 commit 9f34347
Show file tree
Hide file tree
Showing 68 changed files with 5,238 additions and 303 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ yarn-error.log*
.vercel

# Hugo resources folder
resources
resources

# Env
.env*
47 changes: 47 additions & 0 deletions api/github.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Fetches star count, contributor count and top contributors from the Github API
import axios from "axios";
import parse from "parse-link-header";

const options = {
headers: { Authorization: `Bearer ${process.env.GITHUB_ACCESS_TOKEN}` },
};

export default async function handler(request, response) {
try {
// Fetch the data
const [starsData, totalContributorsData, topContributorsData] =
await Promise.all([
// Stars
axios.get("https://api.github.com/repos/deepset-ai/haystack", options),

// Total contributors
axios.get(
"https://api.github.com/repos/deepset-ai/haystack/contributors?per_page=1",
options
),

// Top 10 contributors
axios.get(
"https://api.github.com/repos/deepset-ai/haystack/contributors?per_page=10",
options
),
]);

const stars = starsData.data.stargazers_count;
const parsed = parse(totalContributorsData.headers.link); // parse link header to get total pages
const contributors = parsed.last.page;
const topContributors = topContributorsData.data.map((contrib) => ({
name: contrib.login,
image: contrib.avatar_url,
contributions: contrib.contributions,
}));

return response.status(200).json({
stars,
contributors,
top_contributors: topContributors,
});
} catch (e) {
return response.status(500).json({ message: e.message });
}
}
10 changes: 10 additions & 0 deletions archetypes/tutorials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
layout: tutorial
title: "{{ replace .Name "-" " " | title }}"
date: {{ dateFormat "2006-01-02" .Date }}
last-update: {{ dateFormat "2006-01-02" .Date }}
draft: true
category:
level:
description:
---
66 changes: 28 additions & 38 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ languageCode = 'en-us'
title = 'Haystack Home'
theme = "haystack"

[permalinks]
tutorials = "/tutorials/:filename/"

[markup]
# Code blocks
[markup.highlight]
anchorLineNos = false
codeFences = true
guessSyntax = false
hl_Lines = ''
hl_inline = false
lineAnchors = ''
lineNoStart = 1
lineNos = false
lineNumbersInTable = true
noClasses = true
noHl = false
style = 'solarized-light'
tabWidth = 4

# Toc link levels (h2)
[markup.tableOfContents]
endLevel = 2
startLevel = 2

# Allow html in markdown
[markup.goldmark.renderer]
unsafe= true

# Main navigation
[menu]
Expand Down Expand Up @@ -72,41 +100,3 @@ theme = "haystack"
url = '/use-cases/'
parent = 'overview'
weight = 7

# Community children
[[menu.main]]
name = 'Discord Community'
url = '/discord-community/'
parent = 'community'
weight = 1

[[menu.main]]
name = 'Open NLP Meetup'
url = '/open-nlp-meetup/'
parent = 'community'
weight = 2

[[menu.main]]
name = 'Open Source Community'
url = '/open-source-community/'
parent = 'community'
weight = 3

[[menu.main]]
name = 'deepset on Hugging Face'
url = 'https://huggingface.co/deepset'
parent = 'community'
weight = 4

# Tutorials children
[[menu.main]]
name = 'Tutorial 1'
url = '/tutorial-1/'
parent = 'tutorials'
weight = 1

[[menu.main]]
name = 'Tutorial 2'
url = '/tutorial-2/'
parent = 'tutorials'
weight = 1
16 changes: 16 additions & 0 deletions content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,20 @@ github:
url: https://github.com/deepset-ai/haystack
contributors:
title: Most active contributors

# Community
community:
discord:
title: Join our community
text: Lorem ipsum dolor sit amet, consectetur adipisicing elit, nisi quisquam!
icon: /images/icons/discord.svg
buttons:
- buttonText: Join Discord
url: https://discord.com/invite/VBpFzsgRVF
newsletter:
title: Sign up to future newsletters
text: Lorem ipsum dolor sit amet, consectetur adipisicing elit, nisi quisquam!
icon: /images/icons/email.svg
inputPlaceholder: Email address..
buttonText: Submit
---
Loading

0 comments on commit 9f34347

Please sign in to comment.