Skip to content

Commit 43a9577

Browse files
authored
Merge pull request #55 from teofum/main
webring stuff
2 parents 6494f73 + 3fb4d83 commit 43a9577

File tree

7 files changed

+193
-72
lines changed

7 files changed

+193
-72
lines changed

.github/workflows/deploy.yml

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
node-version: 18
2121
cache: npm
2222

23+
- name: test thing
24+
run: node gen-webring-routes.js
25+
2326
- name: Install dependencies
2427
run: npm ci
2528
- name: Build website

docusaurus.config.ts

+80-72
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,159 @@
1-
import {themes as prismThemes} from 'prism-react-renderer';
2-
import type {Config} from '@docusaurus/types';
3-
import type * as Preset from '@docusaurus/preset-classic';
4-
import remarkMath from 'remark-math';
5-
import rehypeKatex from 'rehype-katex';
1+
import { themes as prismThemes } from "prism-react-renderer";
2+
import type { Config } from "@docusaurus/types";
3+
import type * as Preset from "@docusaurus/preset-classic";
4+
import remarkMath from "remark-math";
5+
import rehypeKatex from "rehype-katex";
66

77
const config: Config = {
8-
title: 'Graphics Programming Discord',
9-
tagline: 'Articles, guides, tips and tricks from and for frogs and forgis of the graphics programming discord. This is what we do:',
10-
favicon: 'img/favicon.ico',
8+
title: "Graphics Programming Discord",
9+
tagline:
10+
"Articles, guides, tips and tricks from and for frogs and forgis of the graphics programming discord. This is what we do:",
11+
favicon: "img/favicon.ico",
1112

1213
// Set the production url of your site here
13-
url: 'https://graphicsprogramming.github.io/',
14+
url: "https://graphicsprogramming.github.io/",
1415
// Set the /<baseUrl>/ pathname under which your site is served
1516
// For GitHub pages deployment, it is often '/<projectName>/'
16-
baseUrl: '/',
17+
baseUrl: "/",
1718

1819
// GitHub pages deployment config.
19-
organizationName: 'GraphicsProgramming',
20-
projectName: 'blog',
21-
deploymentBranch: 'gh-pages',
20+
organizationName: "GraphicsProgramming",
21+
projectName: "blog",
22+
deploymentBranch: "gh-pages",
2223
trailingSlash: false,
2324

24-
onBrokenLinks: 'warn',
25-
onBrokenMarkdownLinks: 'warn',
25+
onBrokenLinks: "warn",
26+
onBrokenMarkdownLinks: "warn",
2627

27-
plugins: [[ require.resolve('docusaurus-lunr-search'), {
28-
languages: ['en'] // language codes
29-
}]],
28+
plugins: [
29+
[
30+
require.resolve("docusaurus-lunr-search"),
31+
{
32+
languages: ["en"], // language codes
33+
},
34+
],
35+
],
3036

3137
// Even if you don't use internationalization, you can use this field to set
3238
// useful metadata like html lang. For example, if your site is Chinese, you
3339
// may want to replace "en" with "zh-Hans".
3440
i18n: {
35-
defaultLocale: 'en',
36-
locales: ['en'],
41+
defaultLocale: "en",
42+
locales: ["en"],
3743
},
3844
stylesheets: [
3945
{
40-
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
41-
type: 'text/css',
46+
href: "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css",
47+
type: "text/css",
4248
integrity:
43-
'sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+',
44-
crossorigin: 'anonymous',
45-
}
49+
"sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+",
50+
crossorigin: "anonymous",
51+
},
4652
],
4753
presets: [
4854
[
49-
'classic',
55+
"classic",
5056
{
5157
docs: {
52-
routeBasePath: 'docs',
53-
sidebarPath: './sidebars.ts',
58+
routeBasePath: "docs",
59+
sidebarPath: "./sidebars.ts",
5460
},
5561
blog: {
5662
showLastUpdateTime: true,
5763
showLastUpdateAuthor: true,
5864
showReadingTime: true,
5965
feedOptions: {
60-
type: ['rss', 'atom'],
66+
type: ["rss", "atom"],
6167
xslt: true,
6268
},
6369
// Remove this to remove the "edit this page" links.
64-
editUrl:
65-
'https://github.com/GraphicsProgramming/blog',
70+
editUrl: "https://github.com/GraphicsProgramming/blog",
6671
// Useful options to enforce blogging best practices
67-
onInlineTags: 'warn',
68-
onInlineAuthors: 'warn',
69-
onUntruncatedBlogPosts: 'warn',
72+
onInlineTags: "warn",
73+
onInlineAuthors: "warn",
74+
onUntruncatedBlogPosts: "warn",
7075
//routeBasePath: '/',
71-
blogSidebarCount: 'ALL',
76+
blogSidebarCount: "ALL",
7277
remarkPlugins: [remarkMath],
7378
rehypePlugins: [rehypeKatex],
7479
},
7580
theme: {
76-
customCss: './src/css/custom.css',
81+
customCss: "./src/css/custom.css",
7782
},
7883
sitemap: {
79-
changefreq: 'always'
80-
}
84+
changefreq: "always",
85+
},
8186
} satisfies Preset.Options,
8287
],
8388
],
8489

8590
themeConfig: {
8691
colorMode: {
87-
defaultMode: 'dark',
92+
defaultMode: "dark",
8893
respectPrefersColorScheme: true,
8994
},
90-
image: 'img/social-embed.png',
95+
image: "img/social-embed.png",
9196
navbar: {
92-
title: 'Graphics Programming',
97+
title: "Graphics Programming",
9398
logo: {
94-
alt: 'Graphics Programming',
95-
src: 'img/gp-discord-logo.webp',
99+
alt: "Graphics Programming",
100+
src: "img/gp-discord-logo.webp",
96101
},
97102
items: [
98103
{
99-
to: '/blog',
100-
label: 'Blog',
101-
position: 'left'
104+
to: "/blog",
105+
label: "Blog",
106+
position: "left",
107+
},
108+
{
109+
type: "docSidebar",
110+
sidebarId: "discordServer",
111+
position: "left",
112+
label: "Discord Server",
102113
},
103114
{
104-
type: 'docSidebar',
105-
sidebarId: 'discordServer',
106-
position: 'left',
107-
label: 'Discord Server',
115+
type: "docSidebar",
116+
sidebarId: "communityProjects",
117+
position: "left",
118+
label: "Community Projects",
108119
},
109120
{
110-
type: 'docSidebar',
111-
sidebarId: 'communityProjects',
112-
position: 'left',
113-
label: 'Community Projects'
114-
}
121+
to: "/webring",
122+
label: "Webring",
123+
position: "left",
124+
},
115125
],
116126
},
117127
footer: {
118-
style: 'dark',
128+
style: "dark",
119129
links: [
120130
{
121-
title: 'Community',
131+
title: "Community",
122132
items: [
123133
{
124-
label: 'Discord',
125-
href: 'https://discord.com/invite/graphicsprogramming',
134+
label: "Discord",
135+
href: "https://discord.com/invite/graphicsprogramming",
126136
},
127137
{
128-
label: 'YouTube',
129-
href: 'https://www.youtube.com/@graphicsprogramming9074',
138+
label: "YouTube",
139+
href: "https://www.youtube.com/@graphicsprogramming9074",
130140
},
131141
{
132-
label: 'Twitter',
133-
href: 'https://x.com/i/communities/1500963350825472000'
134-
}
142+
label: "Twitter",
143+
href: "https://x.com/i/communities/1500963350825472000",
144+
},
135145
],
136146
},
137147
{
138-
title: 'More',
148+
title: "More",
139149
items: [
140150
{
141-
label: 'Blog',
142-
to: 'https://graphics-programming.org/',
151+
label: "Blog",
152+
to: "https://graphics-programming.org/",
143153
},
144154
{
145-
label: 'GitHub',
146-
href: 'https://github.com/GraphicsProgramming',
155+
label: "GitHub",
156+
href: "https://github.com/GraphicsProgramming",
147157
},
148158
],
149159
},
@@ -153,9 +163,7 @@ const config: Config = {
153163
prism: {
154164
theme: prismThemes.duotoneLight,
155165
darkTheme: prismThemes.duotoneDark,
156-
additionalLanguages: [
157-
'glsl'
158-
]
166+
additionalLanguages: ["glsl"],
159167
},
160168
} satisfies Preset.ThemeConfig,
161169
};

gen-webring-routes.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const fs = require("fs");
2+
3+
// Import ze froges
4+
const frogs = require("./static/webring/froglist.json");
5+
6+
function makeHtmlRedirect(frog) {
7+
return `
8+
<!DOCTYPE HTML>
9+
<html lang="en-US">
10+
<head>
11+
<meta charset="UTF-8">
12+
<meta http-equiv="refresh" content="0; url=${frog.url}">
13+
<script type="text/javascript">
14+
// JS redirect as fallback if the meta tag doesn't work
15+
window.location.href = "${frog.url}"
16+
</script>
17+
<title>Page Redirection</title>
18+
</head>
19+
<body>
20+
<!-- And a link, just in case -->
21+
If you are not redirected automatically, follow this <a href='${frog.url}'>link</a>.
22+
</body>
23+
</html>`;
24+
}
25+
26+
function makeRoutes(frog, nextFrog, prevFrog) {
27+
fs.mkdirSync(`./static/webring/frogs/${frog.name}`, { recursive: true });
28+
fs.appendFileSync(`./static/webring/frogs/${frog.name}.html`, makeHtmlRedirect(frog));
29+
fs.appendFileSync(`./static/webring/frogs/${frog.name}/next.html`, makeHtmlRedirect(nextFrog));
30+
fs.appendFileSync(`./static/webring/frogs/${frog.name}/prev.html`, makeHtmlRedirect(prevFrog));
31+
}
32+
33+
frogs.forEach((frog, i) => {
34+
const nextFrog = frogs.at((i + 1) % frogs.length);
35+
const prevFrog = frogs.at(i - 1); // array.at(-1) returns the last element
36+
37+
makeRoutes(frog, nextFrog, prevFrog);
38+
});

src/pages/index.tsx

+16
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@ export default function Home(): JSX.Element {
4343
<HomepageHeader />
4444
<main>
4545
<HomepageFeatures />
46+
47+
<div style={{
48+
display: 'flex',
49+
gap: '0.25rem',
50+
justifyContent: 'center',
51+
}}>
52+
<a href="/webring/frogs/gp-blog/prev">⬅️</a>
53+
<a href="/webring/frogs/">
54+
<img src="/img/froge.webp" alt="a friendly froge" style={{
55+
objectFit: 'contain',
56+
width: '1.5em',
57+
height: '1.5em',
58+
}} />
59+
</a>
60+
<a href="/webring/frogs/gp-blog/next">➡️</a>
61+
</div>
4662
</main>
4763
</Layout>
4864
);

src/pages/webring.tsx

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from "react";
2+
import Layout from "@theme/Layout";
3+
4+
import froglist from "/static/webring/froglist.json";
5+
6+
export default function Hello() {
7+
return (
8+
<Layout title="GP Webring Index" description="GP Webring Index">
9+
<div
10+
style={{
11+
display: "flex",
12+
flexDirection: "column",
13+
justifyContent: "center",
14+
flexGrow: 1,
15+
padding: "3rem 2rem",
16+
width: "100%",
17+
maxWidth: "768px",
18+
margin: "0 auto",
19+
}}
20+
>
21+
<h1>Graphics Programming Webring</h1>
22+
<ul style={{ padding: 0, margin: 0 }}>
23+
{froglist.map((frog: any, i: number) => (
24+
<li
25+
style={{
26+
listStyle: "none",
27+
display: "flex",
28+
flexDirection: "column",
29+
}}
30+
>
31+
<a href={frog.url} style={{ fontSize: "1.25rem" }}>
32+
{frog.displayName}
33+
</a>
34+
<p>{frog.description}</p>
35+
</li>
36+
))}
37+
</ul>
38+
</div>
39+
</Layout>
40+
);
41+
}

static/img/froge.webp

3.9 KB
Binary file not shown.

static/webring/froglist.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"name": "gp-blog",
4+
"url": "https://graphics-programming.org/",
5+
"displayName": "Graphics Programming Blog",
6+
"description": "The official site for the Graphics Programming discord"
7+
},
8+
{
9+
"name": "bluescreen",
10+
"url": "https://fumagalli.ar/",
11+
"displayName": "Teo Fumagalli (bluescreen)",
12+
"description": "Hi! I made a website with stuff in it"
13+
}
14+
]
15+

0 commit comments

Comments
 (0)