Skip to content

Commit 42e9c6c

Browse files
authored
Merge branch 'main' into v1.11.0-reference
2 parents 19e67fd + e501e49 commit 42e9c6c

36 files changed

+28
-37
lines changed

src/components/GridItem/Tutorial.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
import Image from "@components/Image/index.astro";
33
import type { CollectionEntry } from "astro:content";
4+
import { removeLocalePrefix } from "@i18n/utils";
45
56
interface Props {
67
item: CollectionEntry<"tutorials">;
@@ -10,7 +11,7 @@ interface Props {
1011
const { item, lazyLoad } = Astro.props;
1112
---
1213

13-
<a href={`/tutorials/${item.slug}/`} class="group hover:no-underline">
14+
<a href={`/tutorials/${removeLocalePrefix(item.slug).slice(1)}/`} class="group hover:no-underline">
1415
{
1516
item.data.featuredImageAlt && item.data.featuredImage && (
1617
<Image
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: p5.colorGenerator
2+
category: color
3+
description: p5.colorGenerator generates harmonious color schemes by starting from a given base color or selecting a random color as a starting point.
4+
author:
5+
- name: Alex Codes Art
6+
url: https://alexcodesart.com
7+
sourceUrl: https://github.com/alexandru-postolache/p5.colorGenerator
8+
websiteUrl: https://alexandru-postolache.github.io/p5.colorGenerator/demo
9+
featuredImage: "../images/p5.colorGenerator.png"
10+
featuredImageAlt: Waves coloured using different tints of yellow
Loading

src/content/pages/en/education-resources.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: education-resources
32
title: Education Resources
43
---
54

src/content/pages/en/libraries.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: libraries
32
title: Libraries
43
---
54

src/content/pages/en/reference.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: reference
32
title: Reference
43
---
54

src/content/tutorials/en/animating-with-media-objects.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: animating-with-media-objects
32
title: "Animating with Media Objects"
43
description: Learn how to load images and GIFs to your sketches by creating an interactive garden!
54
category: introduction

src/content/tutorials/en/color-gradients.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: color-gradients
32
title: "Color Gradients"
43
description: Use radial gradients, linear gradients, and blend modes to create lens flare stickers & colorful filters on top of a webcam selfie.
54
category: drawing

src/content/tutorials/en/conditionals-and-interactivity.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: conditionals-and-interactivity
32
title: "Conditionals and Interactivity"
43
description: A tutorial on how to use conditional statements and make interactive sketches.
54
category: introduction

src/content/tutorials/en/coordinates-and-transformations.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: coordinates-and-transformations
32
title: "Coordinates and Transformations"
43
description: An overview of the different ways you can position objects in WebGL mode.
54
category: webgl

src/content/tutorials/en/creating-styling-html.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: creating-styling-html
32
title: "Creating and Styling HTML"
43
description: Dive into the art of creative coding and learn to build and beautify HTML with p5.js.
54
category: web-design

src/content/tutorials/en/custom-geometry.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: custom-geometry
32
title: "Creating Custom Geometry in WebGL"
43
description: A guide to the different ways you can create your own 3D shapes.
54
category: webgl

src/content/tutorials/en/custom-shapes-and-smooth-curves.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: custom-shapes-and-smooth-curves
32
title: "Custom Shapes and Smooth Curves"
43
description: Use vertex(), bezierVertex(), beginShape() and endShape() to create angular and curved sparkle stickers to place on top of your webcam selfie.
54
category: drawing

src/content/tutorials/en/data-structure-garden.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: data-structure-garden
32
title: "Data Structure Garden"
43
description: A tutorial on how to use JavaScript objects and arrays.
54
category: introduction

src/content/tutorials/en/field-guide-to-debugging.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: field-guide-to-debugging
32
title: "Field Guide to Debugging"
43
description: Learn some healthy habits and best practices for locating bugs in your program, and finding ways to overcome them.
54
category: advanced

src/content/tutorials/en/get-started.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: get-started
32
title: Get Started
43
description: A tutorial that introduces basic p5.js functions and guides you through the steps to create an interactive landscape.
54
category: introduction

src/content/tutorials/en/getting-started-with-nodejs.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: getting-started-with-nodejs
32
title: "Getting Started with Node.js"
43
description: Learn about HTTP requests and how to use Node.js in your p5.js projects to create dynamic projects that save and retrieve files.
54
category: advanced

src/content/tutorials/en/how-to-optimize-your-sketches.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: how-to-optimize-your-sketches
32
title: How to Optimize Your Sketches
43
description: An advanced tutorial on how to optimize code in your sketches to run more efficiently.
54
category: advanced

src/content/tutorials/en/intro-to-shaders.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: intro-to-shaders
32
title: "Introduction to Shaders"
43
description: An introduction to the different ways you can create interesting visual effects with your computer's GPU.
54
category: webgl

src/content/tutorials/en/layered-rendering-with-framebuffers.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: layered-rendering-with-framebuffers
32
title: "Layered Rendering with Framebuffers"
43
description: Framebuffers are the fastest way to create a scene out of multiple layers in WebGL. Explore how to use them, and the unique 3D information they provide.
54
category: webgl

src/content/tutorials/en/lights-camera-materials.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: lights-camera-materials
32
title: "Lights, Camera, Materials"
43
description: Learn how to light and frame 3D scenes, and how to style 3D objects.
54
category: webgl

src/content/tutorials/en/loading-and-selecting-fonts.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: loading-and-selecting-fonts
32
title: "Loading and Selecting Fonts"
43
description: "Explore typography in creative coding: A Quick guide to choosing and selecting fonts."
54
category: web-design

src/content/tutorials/en/optimizing-webgl-sketches.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: optimizing-webgl-sketches
32
title: "Optimizing WebGL Sketches"
43
description: Tips to help make your sketches run as smoothly as possible on as many devices as possible.
54
category: webgl

src/content/tutorials/en/organizing-code-with-functions.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: organizing-code-with-functions
32
title: Organizing Code with Functions
43
description: A tutorial on how to create and use functions to help you organize your code.
54
category: introduction

src/content/tutorials/en/p5js-with-screen-reader.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: p5js-with-screen-reader
32
title: "How to Use the p5.js Web Editor with a Screen Reader"
43
description: A tutorial for setting up the p5.js Web Editor for screen readers.
54
category: accessibility

src/content/tutorials/en/repeating-with-loops.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: repeating-with-loops
32
title: "Repeating with Loops"
43
description: "Create a crawling caterpillar race using loops and arrays!"
54
category: introduction

src/content/tutorials/en/responding-to-inputs.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: responding-to-inputs
32
title: "Responding to Inputs"
43
description: "Code nostalgia: Unleash your creativity and bring a vintage snake game to life with p5.js!"
54
category: web-design

src/content/tutorials/en/setting-up-your-environment.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: setting-up-your-environment
32
title: "Setting Up Your Environment"
43
description: A quick tutorial for setting up the p5.js Web Editor and VS Code to write and save p5.js projects.
54
category: introduction
@@ -275,7 +274,7 @@ Once your project is saved, you can share it!
275274
- The Coding Train: [1.2: p5.js Web Editor - p5.js Tutorial](https://www.youtube.com/watch?v=MXs1cOlidWs)
276275
- [p5.js reference page](/reference/)
277276
- [Javascript - MDN reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
278-
- [Field Guide to Debugging](https://docs.google.com/document/d/1Uc5Uey4_UDgix6-O0ez-pcRD-FZQSOaRD9TAGZYzD6c/edit)
277+
- [Field Guide to Debugging](/tutorials/field-guide-to-debugging)
279278
- [How to Use the p5.js Web Editor with a Screen Reader](/tutorials/p5js-with-screen-reader/)
280279

281280
---
@@ -446,7 +445,7 @@ Visit the [p5.js reference](/reference/) for more p5.js functions, such as other
446445
It is easy to spell function names wrong or forget a comma. Syntax rules help the computer interpret code. When a “rule” is broken (for example, if [`circle()`](/reference/p5/circle) is spelled wrong), a message will appear in the browser’s console. These errors are commonly referred to as bugs; when your code does not execute correctly, there might be a bug in your code! 
447446

448447
- Visit these resources for instructions on how to view the console in specific browsers: [Chrome](https://developer.chrome.com/docs/devtools/console/reference/) | [Firefox](https://firefox-source-docs.mozilla.org/devtools-user/web_console/) | [Safari](https://support.apple.com/guide/safari-developer/safari-developer-tools-overview-dev073038698/11.0/mac/10.13) | [Edge](https://learn.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/console/)
449-
- Visit the [Field Guide to Debugging](https://docs.google.com/document/d/1Uc5Uey4_UDgix6-O0ez-pcRD-FZQSOaRD9TAGZYzD6c/edit) for more information on how to fix errors in your code.
448+
- Visit the [Field Guide to Debugging](/tutorials/field-guide-to-debugging) for more information on how to fix errors in your code.
450449

451450

452451
### Accessibility note
@@ -466,7 +465,7 @@ If you are using a screen reader, use the [p5.js Web Editor](https://editor.p5js
466465
- The Coding Train: [1.2: p5.js Web Editor - p5.js Tutorial](https://www.youtube.com/watch?v=MXs1cOlidWs)
467466
- [p5.js reference page](/reference/)
468467
- [Javascript - MDN reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
469-
- [Field Guide to Debugging](https://docs.google.com/document/d/1Uc5Uey4_UDgix6-O0ez-pcRD-FZQSOaRD9TAGZYzD6c/edit)
468+
- [Field Guide to Debugging](/tutorials/field-guide-to-debugging)
470469
- [p5.js with VSCode](https://www.youtube.com/watch?v=zMAnM9ly0a8) (video tutorial)
471470
- [VSCode Overview](https://code.visualstudio.com/docs/getstarted/introvideos)
472471
- [p5.vscode reference](https://github.com/antiboredom/p5.vscode/blob/master/README.md)

src/content/tutorials/en/simple-melody-app.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: simple-melody-app
32
title: "Simple Melody App"
43
description: Use p5.Oscillator objects to generate musical notes in an app where users can write and replay melodies they create by interacting with the canvas!
54
category: advanced

src/content/tutorials/en/speak-with-your-hands.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: speak-with-your-hands
32
title: "Abracadabra: Speak With Your Hands in p5.js and ml5.js"
43
description: Control sketches with your hands using ml5.js
54
category: advanced

src/content/tutorials/en/variables-and-change.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: variables-and-change
32
title: "Variables and Change"
43
description: Learn about variables and how they can be used to create animated sketches!
54
category: introduction

src/content/tutorials/en/writing-accessible-canvas-descriptions.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
slug: writing-accessible-canvas-descriptions
32
title: "Writing Accessible Canvas Descriptions"
43
description: A tutorial for how to label p5.js code for screen readers.
54
category: accessibility

src/layouts/BaseLayout.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { capitalize, getTopicInfo, type PageTopic } from "../pages/_utils";
1010
import "@styles/base.scss";
1111
import type { CollectionEntry } from "astro:content";
1212
import { getCollectionInLocaleWithFallbacks } from "@pages/_utils";
13+
import { removeLocalePrefix } from "@i18n/utils";
1314
1415
interface Props {
1516
title: string;
@@ -39,7 +40,7 @@ const currentLocale = getCurrentLocale(Astro.url.pathname);
3940
4041
const slug = title.toLowerCase().split(/\s+/).join('-');
4142
const pages = await getCollectionInLocaleWithFallbacks("pages", currentLocale);
42-
const headerPage = pages.find((page) => page.slug === slug);
43+
const headerPage = pages.find((page) => removeLocalePrefix(page.slug).slice(1) === slug);
4344
let HeaderContent: any = undefined;
4445
if (headerPage) {
4546
const { Content } = await headerPage.render();

src/middleware.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@ export const ensureCorrectLocalePrefixesInHtmlLinks = (
6565
$("a").each(function () {
6666
let href = $(this).attr("href");
6767
// Skip if href is undefined, an external link, or written with a dot slash
68-
if (!href || href.startsWith("http") || href.startsWith("./")) return;
68+
if (
69+
!href ||
70+
href.startsWith("http") ||
71+
href.startsWith("./") ||
72+
href.startsWith("#")
73+
)
74+
return;
6975

7076
const startsWithLocale = nonDefaultSupportedLocales.some(
7177
(locale) => href && href.startsWith(`/${locale}/`),

src/pages/[locale]/education-resources/index.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { nonDefaultSupportedLocales } from "@i18n/const";
66
import { setJumpToState, type JumpToLink } from "@/src/globals/state";
77
import { getCurrentLocale, getUiTranslator } from "@i18n/utils";
88
import { categories } from "@/src/content/tutorials/config";
9+
import { removeLocalePrefix } from "@i18n/utils";
910
1011
export async function getStaticPaths() {
1112
const pages = nonDefaultSupportedLocales.map(async (locale) => ({
@@ -22,7 +23,7 @@ export async function getStaticPaths() {
2223
}
2324
2425
const { pages, locale } = Astro.props;
25-
const page = pages.find((page) => page.slug === 'education-resources')!
26+
const page = pages.find((page) => removeLocalePrefix(page.slug).slice(1) === 'education-resources')!
2627
2728
const { Content } = await page.render();
2829

src/pages/education-resources/index.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import { getCollectionInDefaultLocale } from "@pages/_utils";
66
import { setJumpToState, type JumpToLink } from "@/src/globals/state";
77
import { getCurrentLocale, getUiTranslator } from "@i18n/utils";
88
import { categories } from "@/src/content/tutorials/config";
9+
import { removeLocalePrefix } from "@i18n/utils";
910
1011
const pages = await getCollectionInDefaultLocale("pages");
11-
const page = pages.find((page) => page.slug === 'education-resources')!
12+
const page = pages.find((page) => removeLocalePrefix(page.slug).slice(1) === 'education-resources')!
1213
1314
const { Content } = await page.render();
1415

0 commit comments

Comments
 (0)