Skip to content

Convert to Eleventy. #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
19883af
Remove empty file.
davidlehn Feb 24, 2024
e95d49b
Convert to Eleventy.
davidlehn Feb 24, 2024
ba19a52
Use installed eleventy.
davidlehn Apr 26, 2024
386eb14
Remove unused fields.
davidlehn Apr 26, 2024
b0fa2a8
Convert README to markdown.
davidlehn May 1, 2024
a8a8b0c
Add 404 page.
davidlehn May 1, 2024
d366038
Ignore .backup files.
davidlehn May 1, 2024
eac8e81
Use Cloudflare Pages Fuction for playground proxy..
davidlehn May 1, 2024
b3aa460
Add wrangler; upgrade eleventy to v3.0.0.
BigBlueHat Mar 27, 2025
0dfc72b
Ignore package-lock.json.
BigBlueHat Mar 27, 2025
2557625
Add .editorconfig.
BigBlueHat Mar 27, 2025
0f90edc
Add npm run pages command.
BigBlueHat Mar 31, 2025
0504c10
Add info about npm run build & pages.
BigBlueHat Mar 31, 2025
4162056
Copy over _headers and _redirects.
BigBlueHat Mar 31, 2025
7fd7d12
Migrate root .htaccess to _redirects.
BigBlueHat Mar 27, 2025
ae855ea
Remove images/.htaccess; handled by ignores.
BigBlueHat Mar 27, 2025
55bea6f
Migrate context/.htaccess to _headers/_redirects.
BigBlueHat Mar 27, 2025
612b36d
Remove broken spec/ED/.htaccess.
BigBlueHat Mar 27, 2025
39d6139
Migrate spec/latest/.htaccess.
BigBlueHat Mar 27, 2025
f40f137
Absolutize URLs in 404 page.
BigBlueHat Mar 31, 2025
ffeb844
Use middleware to handle conneg in test-suite.
BigBlueHat Mar 31, 2025
df0ce8e
Parse and sort accept headers; pick best q.
BigBlueHat Mar 31, 2025
731c01f
Migrate test-suite/tests/ redirs & headers.
BigBlueHat Mar 31, 2025
b91a537
Remove utils/; No longer needed.
BigBlueHat Mar 31, 2025
3e7ac45
Switch to type: module.
BigBlueHat Apr 1, 2025
515c98a
Add initial test-redirects.js script.
BigBlueHat Apr 1, 2025
717bd90
Test Link headers via _headers.
BigBlueHat Apr 2, 2025
545d6dc
Optimize _headers order and format.
BigBlueHat Apr 2, 2025
1297213
Reorder test-redirects.js; group test types.
BigBlueHat Apr 2, 2025
b4ebf27
Test all redirects in _redirects.
BigBlueHat Apr 2, 2025
4fedf47
Optimize redirect order; https for schema.org.
BigBlueHat Apr 2, 2025
6934340
Set wrangler compatibility date.
BigBlueHat Apr 2, 2025
a66b568
Remove `eleventy --serve`; promote using `run pages`.
BigBlueHat Apr 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
94 changes: 94 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// development host for playground proxy
const PLAYGROUND_PROXY_HOST = 'http://localhost:8788';

const drafts = [
'CG-FINAL',
'CR',
'ED',
'FCGS',
'PR',
'REC',
'WD',
'latest'
];

export default async function(eleventyConfig) {
eleventyConfig.addPassthroughCopy('404.html');
eleventyConfig.addPassthroughCopy('.htaccess');
eleventyConfig.addPassthroughCopy('LICENSE.md');
eleventyConfig.addPassthroughCopy('_headers');
eleventyConfig.addPassthroughCopy('_redirects');
eleventyConfig.addPassthroughCopy('benchmarks/**/*.{jsonld,nq,md}');
eleventyConfig.addPassthroughCopy('contexts/**/*.{htaccess,html,jsonld}');
eleventyConfig.addPassthroughCopy('contexts/{event,person,place,recipe,remote-context}');
eleventyConfig.addPassthroughCopy('examples/**/*.{html,ttl,txt,json}');
eleventyConfig.addPassthroughCopy('favicon.ico');
eleventyConfig.addPassthroughCopy('fonts');
eleventyConfig.addPassthroughCopy('functions/**/*.js');
eleventyConfig.addPassthroughCopy('images/**/*.{htaccess,png,svg,xcf}');
eleventyConfig.addPassthroughCopy('ns/**/*.{html,jsonld}');
eleventyConfig.addPassthroughCopy('playground/**/*.{css,php,js}');
eleventyConfig.addPassthroughCopy('presentations');
eleventyConfig.addPassthroughCopy('schemas/**/*.json');
eleventyConfig.addPassthroughCopy('site.css');
eleventyConfig.addPassthroughCopy('spec/LICENSE.md');
for(const draft of drafts) {
eleventyConfig.addPassthroughCopy(`spec/${draft}`);
}
eleventyConfig.addPassthroughCopy('static');
eleventyConfig.addPassthroughCopy('test-suite');
eleventyConfig.ignores.add('CONTRIBUTING.md');
eleventyConfig.ignores.add('LICENSE.md');
eleventyConfig.ignores.add('README.md');
eleventyConfig.ignores.add('benchmarks/README.md');
eleventyConfig.ignores.add('contexts/person.html');
eleventyConfig.ignores.add('examples');
eleventyConfig.ignores.add('images/Makefile');
eleventyConfig.ignores.add('images/README.md');
eleventyConfig.ignores.add('minutes/**/*');
eleventyConfig.ignores.add('ns/json-ld.html');
eleventyConfig.ignores.add('playground/dev/README.md');
eleventyConfig.ignores.add('presentations');
eleventyConfig.ignores.add('scripts');
eleventyConfig.ignores.add('spec/tools');
eleventyConfig.ignores.add('spec/LICENSE.md');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ignores can be moved to .eleventyignore to make this file more sane.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with having them here? At least for now. It's a bit confusing as is due to eleventy processing various things, having to pass through others, and ignore particular files. And for drafts, that's done computationally. I thought it made more sense to keep the details in one place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the single place to look. I mostly just like data in inert places whenever possible vs. buried among API calls.

for(const draft of drafts) {
eleventyConfig.ignores.add(`spec/${draft}`);
}
eleventyConfig.ignores.add('test-suite');

// setup development proxy to cloudflare pages function server
if(process.env.ELEVENTY_RUN_MODE === 'serve') {
eleventyConfig.setServerOptions({
onRequest: {
'/playground/proxy': playgroundProxy
}
});
}
};

// proxy to worker proxy
async function playgroundProxy({url}) {
const targetUrl = url.searchParams.get('url');
// eleventy only provides the URL
// approximate what the live playground does
const search = new URLSearchParams();
search.set('url', targetUrl);
const proxyUrl =
new URL(`${PLAYGROUND_PROXY_HOST}/playground/proxy?${search}`);
const res = await fetch(proxyUrl, {
headers: {
'Accept': 'application/ld+json, application/json'
}
});
// create headers object and filter properties
// suffient for the site development purposes
const headers = Object.fromEntries(
Array.from(res.headers.entries()).filter(
v => !['content-length', 'content-encoding'].includes(v[0])));
return {
status: res.status,
headers,
body: await res.text()
}
}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*~
*.backup
*.sw[op]
.DS_Store
node_modules
.wrangler
node_modules/
playground/jsonld.js
_site/
package-lock.json
7 changes: 0 additions & 7 deletions .htaccess

This file was deleted.

100 changes: 100 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!DOCTYPE html>
<html
prefix="
xhv: http://www.w3.org/1999/xhtml/vocab#
xsd: http://www.w3.org/2001/XMLSchema#
rdfs: http://www.w3.org/2000/01/rdf-schema#
dc: http://purl.org/dc/terms/
vcard: http://www.w3.org/2006/vcard/ns#
v: http://rdf.data-vocabulary.org/#"
lang="en" >
<head>
<title>JSON-LD - JSON for Linking Data</title>

<!-- Meta Tags -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />

<!-- Style Sheets -->
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap/bootstrap-responsive.css">
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap/font-awesome.css">
<style>
/** bootstrap 2.3.2 overrides **/
.alert.alert-success a {color: #3d9400; text-decoration: underline }
</style>

<link rel="shortcut icon" href="/favicon.ico" />

<!-- Script tags -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-42886053-1', 'json-ld.org');
ga('send', 'pageview');
</script>
</head>

<body>
<div class="navbar navbar-static-top">
<div class="navbar-inner">
<div class="row-fluid">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand active" href="#"><img src="images/json-ld-data-24.png" alt="JSON-LD logo"> JSON-LD</a>
<div class="nav-collapse">
<ul class="nav">
<li>
<a href="/playground/"><span class="icon-beer"></span> Playground</a>
</li>
<li>
<a href="/learn/"><span class="icon-book"></span> Documentation</a>
</li>
<li><a href="#developers"><span class="icon-beaker"></span> Developers</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="icon-folder-open"></span> Specifications <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li class="nav-header"><strong>W3C Recommendations</strong></li>
<li><a href="https://www.w3.org/TR/json-ld/">Syntax</a></li>
<li><a href="https://www.w3.org/TR/json-ld-api/">Processing Algorithms and API</a></li>
<li><a href="https://www.w3.org/TR/json-ld-framing/">Framing</a></li>
<li class="divider"></li>
<li class="nav-header"><strong>Latest Drafts</strong></li>
<li><a href="https://w3c.github.io/json-ld-syntax/">Syntax</a></li>
<li><a href="https://w3c.github.io/json-ld-api/">Processing Algorithms and API</a></li>
<li><a href="https://w3c.github.io/json-ld-framing/">Framing</a></li>
<li><a href="https://w3c.github.io/json-ld-bp/">Best Practices</a></li>
<li><a href="https://w3c.github.io/json-ld-streaming/">Streaming</a></li>
<li><a href="https://json-ld.github.io/json-ld-star/">JSON-LD-star</a></li>
<li><a href="https://w3c.github.io/json-ld-cbor/">CBOR</a></li>
<li><a href="https://github.com/w3c/json-ld-rc/">Recommended Context</a></li>
<li><a href="https://json-ld.github.io/yaml-ld/">YAML-LD</a></li>
<li><a href="/spec/">1.0 drafts (historic)</a></li>
</ul>
</li>
<li><a href="/images/"><span class="icon-picture"></span> Branding</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>

<div class="container">
<h2>Page not found.</h2>
</div>

<!-- Script tags -->
<script type="text/javascript" src="static/js/bootstrap/bootstrap.js"></script>
</body>
</html>
100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
json-ld.org
===========

Introduction
------------

[![Join the chat at https://gitter.im/json-ld/json-ld.org](https://badges.gitter.im/json-ld/json-ld.org.svg)](https://gitter.im/json-ld/json-ld.org)

This is the source for the https://json-ld.org/ website.

JSON-LD (JavaScript Object Notation for Linking Data) is a lightweight Linked
Data format. It is easy for humans to read and write. It is easy for machines
to parse and generate. It is based on the already successful JSON format and
provides a way to help JSON data interoperate at Web-scale. If you are already
familiar with JSON, writing JSON-LD is very easy. There is a smooth migration
path from the JSON you use today, to the JSON-LD you will use in the future.
These properties make JSON-LD an ideal Linked Data interchange language for
JavaScript environments, Web services, and unstructured databases such as
CouchDB and MongoDB.

If you are already using JSON-LD, add yourself to the [list of users][] in our wiki.


A Simple Example
----------------

A simple example of a JSON object with added semantics::

```json
{
"@context": "https://json-ld.org/contexts/person.jsonld",
"@id": "http://dbpedia.org/resource/John_Lennon",
"name": "John Lennon",
"born": "1940-10-09",
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
}
```

The example above describes a person whose name is John Lennon. The difference
between regular JSON and JSON-LD is that the JSON-LD object above uniquely
identifies itself on the Web and can be used, without introducing ambiguity,
across every Web site, Web services and databases in operation today.

The Playground
--------------

If you would like to play around with JSON-LD markup, you may do so here:

https://json-ld.org/playground/

The Specifications
------------------

If you are a developer, you may be interested in the official JSON-LD W3C
specifications:

* [JSON-LD 1.1 - A JSON-based Serialization for Linked Data][]
* [JSON-LD 1.1 Processing Algorithms and API][]
* [JSON-LD 1.1 Framing][]

A list of all previous specification drafts is also available.

https://json-ld.org/spec/

Website Development
-------------------

- This site is published using [Eleventy][].
- The site is deployed using [Cloudflare Pages][].
- The [playground][] has a special proxy to handle `http:` URLs.

To develop this website locally:

```sh
# install dependencies
npm i
# to just build the static files to `_site/`
npm run build
# to rebuild the files on changes
npm run watch
# to serve `_site/` with Cloudflare Pages feature support
npm run pages # visit http://localhost:8788/
```

Additionally, if you want to use or test the playground `http:` proxy, also run
the [Wrangler][] server to emulate the [Cloudflare Pages Functions][] code:

```sh
npm run dev
```

[Cloudflare Pages Functions]: https://developers.cloudflare.com/pages/functions/
[Cloudflare Pages]: https://pages.cloudflare.com/
[Eleventy]: https://www.11ty.dev/
[JSON-LD 1.1 - A JSON-based Serialization for Linked Data]: http://www.w3.org/TR/json-ld/
[JSON-LD 1.1 Framing]: https://www.w3.org/TR/json-ld-framing/
[JSON-LD 1.1 Processing Algorithms and API]: https://www.w3.org/TR/json-ld-api/
[Wrangler]: https://developers.cloudflare.com/workers/wrangler/
[list of users]: https://github.com/json-ld/json-ld.org/wiki/Users-of-JSON-LD
[playground]: https://json-ld.org/playground/
63 changes: 0 additions & 63 deletions README.rst

This file was deleted.

Loading