Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Graf <tgraf@isovalent.com>
  • Loading branch information
tgraf authored and geakstr committed Aug 12, 2020
0 parents commit 5a6ae88
Show file tree
Hide file tree
Showing 81 changed files with 22,925 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Project dependencies
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
.cache/
# Build directory
public/
.DS_Store
yarn-error.log
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v8.7.0
4 changes: 4 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This work is licensed under the Creative Commons Attribution 4.0 International
License. To view a copy of this license, visit
http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative
Commons, PO Box 1866, Mountain View, CA 94042, USA.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[![License: CC BY 4.0](https://img.shields.io/badge/License-CC%20BY%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/)

# ebpf.io Website


## How to contribute

1. Clone the repo
2. yarn install
3. yarn run develop
4. open http://localhost:8000
5. make changes in: pages/index.js for landing page, or posts/ folder for blog posts
6. everytime you save, localhost:8000 will auto-reload with new preview
7. commit all your new changes to a branch, and submit the PR
7 changes: 7 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/

// You can delete this file if you're not using it
140 changes: 140 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
const parseHtml = require("./scripts/parse-html");

module.exports = {
siteMetadata: {
title: `eBPF`,
description: "eBPF is a revolutionary technology that can run sandboxed programs in the Linux kernel without changing kernel source code or loading a kernel module.",
siteUrl: "https://www.ebpf.io"
},
plugins: [
`gatsby-plugin-react-next`,
`gatsby-plugin-react-helmet`,
"gatsby-plugin-catch-links",
"gatsby-plugin-netlify",
"gatsby-plugin-nprogress",
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: "UA-96283704-3",
head: false
}
},
{
resolve: `gatsby-plugin-sass`,
options: {
precision: 8
}
},
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/posts`,
name: "posts"
}
},
{
resolve: "gatsby-transformer-remark",
options: {
plugins: [
"gatsby-remark-autolink-headers",
{
resolve: `gatsby-remark-prismjs`,
options: {
// Class prefix for <pre> tags containing syntax highlighting;
// defaults to 'language-' (eg <pre class="language-js">).
// If your site loads Prism into the browser at runtime,
// (eg for use with libraries like react-live),
// you may use this to prevent Prism from re-processing syntax.
// This is an uncommon use-case though;
// If you're unsure, it's best to use the default value.
classPrefix: "language-"
}
},
"gatsby-remark-copy-linked-files",
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 700
}
},
`gatsby-remark-responsive-iframe`
]
}
},
{
resolve: `gatsby-plugin-favicon`,
options: {
logo: "./src/favicon.png",
injectHTML: true,
icons: {
android: true,
appleIcon: true,
appleStartup: true,
coast: true,
favicons: true,
firefox: true,
twitter: true,
yandex: true,
windows: true
}
}
},
{
resolve: `gatsby-plugin-feed`,
options: {
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
`,
feeds: [
{
serialize: ({ query: { site, allMarkdownRemark } }) => {
return allMarkdownRemark.edges.map(edge => {
const { hasPreview, previewHtml, mainHtml } = parseHtml(
edge.node
);
return Object.assign({}, edge.node.frontmatter, {
description: previewHtml,
url: site.siteMetadata.siteUrl + edge.node.frontmatter.path,
guid: site.siteMetadata.siteUrl + edge.node.frontmatter.path,
custom_elements: [{ "content:encoded": mainHtml }]
});
});
},
query: `
{
allMarkdownRemark(
limit: 1000,
sort: { order: DESC, fields: [frontmatter___date] }
) {
edges {
node {
html
id
frontmatter {
categories
date
path
title
tags
}
}
}
}
}
`,
output: "/blog/rss.xml"
}
]
}
}
]
};
121 changes: 121 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
const path = require("path");
const createPaginatedPages = require("gatsby-paginate");

const createMetaPage = ({
type,
edges,
createPage,
itemPageTemplate,
listPageTemplate,
pathPrefix
}) => {
const itemTemplate = path.resolve(itemPageTemplate);
const listTamplate = path.resolve(listPageTemplate);

const map = {};
const items = [];
edges.forEach(({ node }) => {
(node.frontmatter[type] || []).forEach(item => {
if (!map[item]) {
map[item] = [];
items.push({
title: item,
url: `${pathPrefix}/${item}`
});
}
map[item].push(node);
});
});

createPage({
path: `${pathPrefix}/`,
component: listTamplate,
context: { type, items }
});

Object.keys(map).forEach(item => {
const posts = map[item];
createPage({
path: `${pathPrefix}/${item}`,
component: itemTemplate,
context: {
type,
title: item,
items: posts,
parentUrl: pathPrefix
}
});
});
};

exports.createPages = ({ boundActionCreators, graphql }) => {
const { createPage } = boundActionCreators;

const blogPostTemplate = path.resolve(`src/templates/blog-post.js`);

return graphql(`
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] }
limit: 10000
) {
edges {
node {
html
id
excerpt
frontmatter {
categories
date
path
title
tags
}
}
}
}
}
`).then(result => {
if (result.errors) {
return Promise.reject(result.errors);
}
const { edges } = result.data.allMarkdownRemark;

createPaginatedPages({
createPage,
edges,
pageTemplate: path.resolve(`src/templates/blog.js`),
paginatePost: "/blog", // old field. not remove
pathPrefix: "/blog", // new field. not remove
pageLength: 8
});

createMetaPage({
createPage,
edges,
type: "tags",
listPageTemplate: path.resolve(`src/templates/categories.js`),
itemPageTemplate: path.resolve(`src/templates/category.js`),
pathPrefix: "/blog/tags"
});

createMetaPage({
createPage,
edges,
type: "categories",
listPageTemplate: path.resolve(`src/templates/categories.js`),
itemPageTemplate: path.resolve(`src/templates/category.js`),
pathPrefix: "/blog/categories"
});

edges.forEach(({ node }) => {
createPage({
path: node.frontmatter.path,
component: blogPostTemplate,
context: {}
});
});

return Promise.resolve();
});
};
29 changes: 29 additions & 0 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Implement Gatsby's SSR (Server Side Rendering) APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/ssr-apis/
*/
const React = require("react");

exports.onRenderBody = (
{ setHeadComponents, setHtmlAttributes, setBodyAttributes },
pluginOptions
) => {
setHeadComponents([
<meta
key="meta-viewport"
name="viewport"
content="width=device-width, initial-scale=1"
/>,
<link
key="putua-one-font"
href="https://fonts.googleapis.com/css?family=Montserrat:400,500,600,700,900&display=swap"
rel="stylesheet"
/>,
<link
key="noto-serif-fonr"
href="https://fonts.googleapis.com/css?family=Noto+Serif&display=swap"
rel="stylesheet"
/>
]);
};
Loading

0 comments on commit 5a6ae88

Please sign in to comment.