Skip to content

Commit 4ea8325

Browse files
Merge pull request #230 from ninjamuffin99/11ty-phase1
11ty phase 1: Moving Blog page + posts to 11ty
2 parents 49c75a2 + 782f678 commit 4ea8325

34 files changed

+290
-183
lines changed

.eleventy.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const { EleventyRenderPlugin } = require("@11ty/eleventy");
2+
3+
4+
module.exports = function(eleventyConfig) {
5+
eleventyConfig.addPlugin(EleventyRenderPlugin);
6+
7+
// used to set the current active dropdown list item to active, depending on current page
8+
eleventyConfig.addShortcode("dropdownActive", function(dropdownItem) {
9+
10+
let isActive = this.page.url.includes(`/${dropdownItem}/`);
11+
return isActive ? "active" : "";
12+
});
13+
14+
// Return your Object options:
15+
return {
16+
dir: {
17+
layouts: "_layouts",
18+
input: "11ty-source",
19+
output: "out"
20+
}
21+
}
22+
};

.github/workflows/main.yml

+22-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
name: CI
22

3-
on: [push, pull_request, workflow_dispatch, repository_dispatch]
3+
on:
4+
push:
5+
pull_request:
6+
repository_dispatch:
7+
workflow_dispatch:
8+
inputs:
9+
deploy_gh_pages:
10+
description: 'Deploy to gh_pages branch (for use in forks)'
11+
required: false
12+
type: boolean
413

514
jobs:
615
build:
@@ -11,12 +20,14 @@ jobs:
1120
with:
1221
node-version: 'latest'
1322
- uses: krdlab/setup-haxe@v1
14-
- name: Build Docker Image
15-
run: node scripts/docker.js buildImage
23+
# - name: Build Docker Image
24+
# run: node scripts/docker.js buildImage
25+
- run: sudo apt-get update && sudo apt-get install -y imagemagick
1626
- name: Build Site
1727
run: |
1828
ls -lah
19-
node scripts/docker.js buildSite
29+
npm install
30+
npm run build
2031
ls -lah
2132
haxe --run RemoveRedirects
2233
# - name: Highlighting
@@ -26,6 +37,13 @@ jobs:
2637
# npm install
2738
# node bin/highlighter.js ../out
2839
# cd ..
40+
- name: Deploy gh_pages
41+
uses: peaceiris/actions-gh-pages@v3
42+
with:
43+
github_token: ${{secrets.GITHUB_TOKEN}}
44+
publish_dir: ./out
45+
force_orphan: true
46+
if: inputs.deploy_gh_pages == true
2947
- name: Deploy Master
3048
uses: peaceiris/actions-gh-pages@v3
3149
with:
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
layout: default.liquid
3+
---
4+
<div class="col-md-8">
5+
6+
<h1 class="title">{{title}}</h1>
7+
8+
{{content}}
9+
10+
</div>
11+
12+
<div class="col-md-4 twitter-widget">
13+
<a class="twitter-timeline" href="https://twitter.com/HaxeFlixel" data-widget-id="491877121183080448" data-height="850">Tweets by @HaxeFlixel</a>
14+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
15+
</div>
16+
17+
</div>
18+

11ty-source/_layouts/blog-post.liquid

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
layout: default.liquid
3+
---
4+
5+
6+
<!-- <%- @partial('header-menu.html.eco', {ablog:"class='active'"}) %> -->
7+
8+
<div class="col-md-8">
9+
10+
<h1 class="title">{{ title }}</h1>
11+
12+
<p class="post-date">{{ postDate }}</h1>
13+
14+
{{ content }}
15+
16+
<br>
17+
<hr>
18+
<br>
19+
20+
<!-- <%- @getDisqus() %> -->
21+
22+
</div>
23+

11ty-source/_layouts/default.liquid

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
{% comment %} <%- @partial('head.html.eco', {title:@getPreparedTitle()}, {description:@getPreparedDescription()}, {keywords:@getPreparedKeywords()}, {author:@site.author or ''}, {styles:@getBlock("styles").add(["/styles/style.css", "/vendor/highlightjs/styles/an-old-hope.min.css"]).toHTML()} ) %> {% endcomment %}
5+
{% renderFile "./11ty-source/_layouts/partials/head.liquid" %}
6+
<body>
7+
8+
{% renderFile "./11ty-source/_layouts/partials/header-menu.liquid" %}
9+
10+
<div class="container container-main">
11+
{% comment %} Make sure each class renders it's title {% endcomment %}
12+
{{ content }}
13+
</div>
14+
15+
{% renderFile "./11ty-source/_layouts/partials/footer.html" %}
16+
17+
{% comment %} <%- @getBlock('scripts').add(@site.scripts).toHTML() %> {% endcomment %}
18+
19+
{%renderFile "./11ty-source/cdn-scripts.liquid"%}
20+
<script src="/11ty-bundle.js"></script>
21+
22+
</body>
23+
24+
</html>
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<footer>
2+
<div class="footer-main">
3+
<div class=" container">
4+
5+
<div class="footer-social">
6+
7+
<iframe width="120px" scrolling="0" height="20px" frameborder="0"
8+
allowtransparency="true"
9+
src="https://ghbtns.com/github-btn.html?user=HaxeFlixel&amp;repo=flixel&amp;type=watch&amp;count=true&amp;size=small"></iframe>
10+
11+
<a href="https://twitter.com/haxeflixel" class="twitter-follow-button" data-show-count="true"
12+
data-lang="en" data-size="small">Follow @haxeflixel</a>
13+
14+
<a class="footer-patreon" href="https://www.patreon.com/haxeflixel" alt="HaxeFlixel Patreon" title="Support us on Patreon">
15+
<img class="patreon-logo" src="/images/patreon-logo.svg" title="HaxeFlixel Patreon">
16+
<img class="patreon-wordmark" src="/images/patreon-wordmark.svg" title="HaxeFlixel Patreon">
17+
</a>
18+
19+
<script>!function (d, s, id)
20+
{
21+
var js, fjs = d.getElementsByTagName (s)[0];
22+
if (!d.getElementById (id))
23+
{
24+
js = d.createElement (s);
25+
js.id = id;
26+
js.src = "//platform.twitter.com/widgets.js";
27+
fjs.parentNode.insertBefore (js, fjs);
28+
}
29+
} (document, "script", "twitter-wjs");</script>
30+
31+
</div>
32+
33+
<div class="footer-powered-by row">
34+
<p>HaxeFlixel is powered by</p>
35+
<a href="https://haxe.org"><img src="/images/haxe.svg" alt="Haxe" title="Haxe"></a>
36+
+
37+
<a href="https://openfl.org"><img class="openfl-footer-logo" src="/images/openfl.svg" alt="OpenFL" title="OpenFL"></a>
38+
+
39+
<a href="https://flixel.org"><img class="flixel-footer-logo" src="/images/flixel.svg" alt="Flixel" title="Flixel"></a>
40+
</div>
41+
42+
</div>
43+
</div>
44+
</footer>
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<head>
2+
3+
<meta charset="utf-8"/>
4+
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
6+
7+
<title>{{ title }}</title>
8+
9+
<meta name="description" content="<%= @description %>"/>
10+
<meta name="keywords" content="<%= @keywords %>"/>
11+
<meta name="author" content="<%= @author %>"/>
12+
<meta name="viewport" content="width=device-width"/>
13+
14+
<link rel="icon" href="/images/haxeflixel.svg">
15+
<link rel="shortcut icon" href="/images/favicon.ico">
16+
17+
<!--[if lt IE 9]>
18+
<script async src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
19+
<![endif]-->
20+
21+
{% comment %} <%- @styles %> {% endcomment %}
22+
<link rel="stylesheet" href="/styles/style.css">
23+
24+
</head>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<header>
2+
<nav>
3+
4+
<div class="navbar navbar-inverse navbar-fixed-top">
5+
<div class="container">
6+
7+
<div class="navbar-header">
8+
<button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
9+
<span class="icon-bar" />
10+
<span class="icon-bar" />
11+
<span class="icon-bar" />
12+
</button>
13+
<a href="/" class="navbar-brand"><img src="/images/haxeflixel-header.svg" height="31" alt="HaxeFlixel" /></a>
14+
</div>
15+
16+
<div class="navbar-collapse collapse">
17+
18+
<ul class="nav navbar-nav">
19+
20+
<li class="dropdown {% dropdownActive 'demos' %}">
21+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Examples <span class="caret"></span></a>
22+
<ul class="dropdown-menu inverse-dropdown">
23+
<li><a href="/demos">Demos</a></li>
24+
<li><a href="https://snippets.haxeflixel.com/">Snippets</a></li>
25+
</ul>
26+
</li>
27+
28+
<li class={% dropdownActive 'showcase' %}>
29+
<a href="/showcase">Showcase</a>
30+
</li>
31+
32+
{% comment %} <li <%= @ablog %>> {% endcomment %}
33+
<li class={% dropdownActive 'blog' %}>
34+
<a href="/blog">Blog</a>
35+
</li>
36+
37+
{% comment %} <li <%= @adocs %>> {% endcomment %}
38+
<li class={% dropdownActive 'documentation' %}>
39+
<a href="/documentation">Docs</a>
40+
</li>
41+
42+
<li >
43+
<a href="http://api.haxeflixel.com">API</a>
44+
</li>
45+
46+
{% comment %} <li <%= @aforum %>> {% endcomment %}
47+
<li>
48+
<a href="https://github.com/HaxeFlixel/flixel/discussions">Forum</a>
49+
</li>
50+
51+
</ul>
52+
53+
{% comment %} <%- @partial('search.html') %> {% endcomment %}
54+
55+
</div>
56+
57+
</div>
58+
59+
</div>
60+
61+
</nav>
62+
</header>

11ty-source/blog.liquid

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "Blog"
3+
layout: blog-layout
4+
---
5+
6+
<div class="container">
7+
<div class="row">
8+
9+
{%- for blog in collections.blogpost reversed -%}
10+
11+
<a href="{{blog.url}}" property="dc:title">
12+
<h3>{{ blog.data.title }}</h3>
13+
</a>
14+
<div class="post-date post-date-preview">{{ blog.data.postDate }}</div>
15+
<p> {{blog.content | strip_html |truncate: 150}}<a href="{{blog.url}}"> read more</a></p>
16+
{% comment %} <p><%- blog.contentPreview %> <a href="<%= blog.url %>"> read more</a></p> {% endcomment %}
17+
18+
<hr>
19+
20+
{%- endfor -%}
21+
22+
</div>
23+
</div>
File renamed without changes.

11ty-source/blog/blog.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"tags": "blogpost"
3+
}

11ty-source/cdn-scripts.liquid

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
2+
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>

11ty-source/scripts.njk

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
permalink: 11ty-bundle.js
3+
---
4+
5+
{% include "../src/files/vendor/twitter-bootstrap-3/js/dropdown.js"%}
6+
{% include "../src/files/vendor/twitter-bootstrap-3/js/transition.js"%}
7+
{% include "../src/files/vendor/twitter-bootstrap-3/js/collapse.js"%}

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
## About
1111

12-
This is the source of [haxeflixel.com](https://haxeflixel.com/). It is made with a Node.js static site generator called
13-
[DocPad](https://docpad.bevry.me/).
12+
This is the source of [haxeflixel.com](https://haxeflixel.com/). It was orgiginally made with a Node.js static site generator called
13+
[DocPad](https://docpad.bevry.me/), but it's in a transition to [11ty](https://www.11ty.dev/)
1414
You can compile this website yourself with a local install of DocPad, pull requests are welcome.
1515

1616
1. [Install DocPad](https://docpad.bevry.me/start/install)
@@ -25,7 +25,7 @@ You can compile this website yourself with a local install of DocPad, pull reque
2525

2626
```batch
2727
npm install
28-
docpad run
28+
npm run start
2929
```
3030
Or if you are a windows user:
3131

@@ -38,8 +38,8 @@ You can compile this website yourself with a local install of DocPad, pull reque
3838

3939
3. [Open http://localhost:9778/](http://localhost:9778/)
4040

41-
4. Start hacking away by modifying the `src` directory, the live reload plugin will compile the site as you save
42-
the files you modify.
41+
<!-- 4. Start hacking away by modifying the `src` directory, the live reload plugin will compile the site as you save
42+
the files you modify. -->
4343

4444
## Contributing
4545

package.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@
2222
},
2323
"main": "node_modules/docpad/bin/docpad-server",
2424
"scripts": {
25-
"start": "docpad run",
26-
"build": "docpad generate --env static"
25+
"start": "run-s start:*",
26+
"start:11ty": "eleventy",
27+
"start:docpad": "docpad run",
28+
"build": "run-p build:*",
29+
"build:docpad": "docpad generate --env static",
30+
"build:11ty": "eleventy"
31+
},
32+
"devDependencies": {
33+
"@11ty/eleventy": "^2.0.1",
34+
"npm-run-all2": "^6.1.2"
2735
}
2836
}

src/documents/blog.html.eco

-24
This file was deleted.

0 commit comments

Comments
 (0)