Skip to content

Commit 125a80a

Browse files
committed
Additional guides and samples
1 parent dda992e commit 125a80a

44 files changed

Lines changed: 1429 additions & 21 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.eleventy.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ module.exports = function(eleventyConfig) {
7070

7171
eleventyConfig.addPassthroughCopy('content/static');
7272

73+
// For LOCAL testing only (build-local.sh sets CERAMIC_SAMPLES_LOCAL):
74+
// serve the locally-built samples under /ceramic-samples so the example
75+
// iframes/thumbnails can point at them (see content/_data/samples.js).
76+
// In production this is skipped: samples are hosted separately.
77+
if (process.env.CERAMIC_SAMPLES_LOCAL) {
78+
eleventyConfig.addPassthroughCopy({ '_samples': 'ceramic-samples' });
79+
}
80+
7381
global.js = eleventyConfig.javascriptFunctions;
7482

7583
return {

‎content/_data/samples.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Base URL under which the built Ceramic samples are served.
2+
//
3+
// In production, the samples are hosted at ceramic-engine.com/ceramic-samples
4+
// (this is the default, so the generated site is unchanged).
5+
//
6+
// For LOCAL testing (see build-local.sh), set the CERAMIC_SAMPLES_LOCAL env
7+
// variable: the samples are then served by the local dev server under
8+
// /ceramic-samples, so the example iframes and thumbnails point at the
9+
// locally-built samples instead of the production ones.
10+
module.exports = {
11+
baseUrl: process.env.CERAMIC_SAMPLES_LOCAL
12+
? '/ceramic-samples'
13+
: 'https://ceramic-engine.com/ceramic-samples'
14+
};

‎content/_layouts/examples.ejs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ for (item of allExamples) {
6666
<% if (sample.startsWith('https:')) { %>
6767
src="<%= sample %>"
6868
<% } else { %>
69-
src="https://ceramic-engine.com/ceramic-samples/<%= sample %>/"
69+
src="<%= samples.baseUrl %>/<%= sample %>/"
7070
<% } %>
7171
width="640"
7272
height="480"
@@ -77,7 +77,7 @@ for (item of allExamples) {
7777
<% if (sample.startsWith('https:')) { %>
7878
<a href="<%= sample %>">Full page</a>
7979
<% } else { %>
80-
<a href="https://ceramic-engine.com/ceramic-samples/<%= sample %>/">Full page</a>
80+
<a href="<%= samples.baseUrl %>/<%= sample %>/">Full page</a>
8181
<% } %>
8282
—
8383
<% if (typeof(source) != 'undefined' && source.startsWith('https:')) { %>

‎content/examples.ejs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ for (item of allExamples) {
4141
<% if (item.data.thumbnail.startsWith('http')) { %>
4242
src="<%= item.data.thumbnail %>"
4343
<% } else { %>
44-
src="https://ceramic-engine.com/ceramic-samples/<%= item.data.sample %>/<%= item.data.thumbnail %>"
44+
src="<%= samples.baseUrl %>/<%= item.data.sample %>/<%= item.data.thumbnail %>"
4545
<% } %>
4646
<% } else { %>
47-
src="https://ceramic-engine.com/ceramic-samples/<%= item.data.sample %>/thumbnail.png"
47+
src="<%= samples.baseUrl %>/<%= item.data.sample %>/thumbnail.png"
4848
<% } %>
4949
alt="<%= item.data.title + ' thumbnail' %>"
5050
/>

content/examples/02-samples/09-graphics.md renamed to content/examples/01-basics/07-graphics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: examples
33
category: examples
4-
menu: Samples
4+
menu: Basics
55
title: Graphics
66
permalink: examples/graphics/
77
sample: graphics
File renamed without changes.
File renamed without changes.

content/examples/02-samples/06-nine-slice.md renamed to content/examples/01-basics/11-nine-slice.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: examples
33
category: examples
4-
menu: Samples
4+
menu: Basics
55
title: Nine-Slice
66
permalink: examples/nine-slice/
77
sample: nine-slice
File renamed without changes.

0 commit comments

Comments
 (0)