diff options
initial commit
-rw-r--r-- | .eleventy.js | 3 | ||||
-rw-r--r-- | eleventy.config.js | 52 | ||||
-rw-r--r-- | favicon.ico | bin | 0 -> 302153 bytes | |||
-rw-r--r-- | favicon.svg | 14 | ||||
-rw-r--r-- | package.json | 30 | ||||
-rw-r--r-- | src/about.md | 8 | ||||
-rw-r--r-- | src/blog.njk | 19 | ||||
-rw-r--r-- | src/css.11ty.js | 37 | ||||
-rw-r--r-- | src/data/err.json | 166 | ||||
-rw-r--r-- | src/data/metadata.json | 12 | ||||
-rw-r--r-- | src/data/navigator.json | 14 | ||||
-rw-r--r-- | src/error.md | 12 | ||||
-rw-r--r-- | src/feed.njk | 27 | ||||
-rw-r--r-- | src/index.css | 62 | ||||
-rw-r--r-- | src/index.md | 11 | ||||
-rw-r--r-- | src/js.11ty.js | 35 | ||||
-rw-r--r-- | src/layouts/base.njk | 29 | ||||
-rw-r--r-- | src/layouts/post.njk | 12 | ||||
-rw-r--r-- | src/post/hello_world.md | 8 | ||||
-rw-r--r-- | src/post/post.json | 3 | ||||
-rw-r--r-- | src/prism.css | 130 | ||||
-rw-r--r-- | src/robot.njk | 7 | ||||
-rw-r--r-- | src/sitemap.njk | 15 |
23 files changed, 706 insertions, 0 deletions
diff --git a/.eleventy.js b/.eleventy.js new file mode 100644 index 0000000..abbd9b8 --- /dev/null +++ b/.eleventy.js @@ -0,0 +1,3 @@ +module.exports = eleventyConfig => { + return require('./eleventy.config.js')(eleventyConfig) +} diff --git a/eleventy.config.js b/eleventy.config.js new file mode 100644 index 0000000..b2e2a5b --- /dev/null +++ b/eleventy.config.js @@ -0,0 +1,52 @@ +module.exports = eleventyConfig => { + eleventyConfig.addPlugin(require('@11ty/eleventy-plugin-syntaxhighlight')) + eleventyConfig.addPlugin(require('@11ty/eleventy-plugin-rss')) + + eleventyConfig.setLibrary('md', require('markdown-it')({ + html: true, + linkify: true, + typographer: true + }).use(require('markdown-it-attrs'))) + + eleventyConfig.addTransform('htmlmin', (content, outputPath) => { + if (outputPath && outputPath.endsWith('.html')) { + const minified = require("html-minifier").minify(content, { + useShortDoctype: true, + removeComments: true, + collapseWhitespace: true + }) + return minified + } + + return content + }) + + const { DateTime } = require('luxon') + eleventyConfig.addFilter('datefmt', date => { + return DateTime.fromJSDate(date, { zone: 'utc' }).toFormat("dd LLL yyyy"); + }) + + eleventyConfig.addPassthroughCopy('static/') + eleventyConfig.addPassthroughCopy('favicon.svg') + eleventyConfig.addPassthroughCopy('favicon.ico') + + return { + dir: { + input: 'src', + output: 'dist', + includes: 'includes', + data: 'data', + layouts: 'layouts' + }, + + dataTemplateEngine: 'njk', + markdownTemplateEngine: 'njk', + htmlTemplateEngine: 'njk', + templateFormats: [ + 'html', + 'md', + 'njk', + '11ty.js' + ] + } +} diff --git a/favicon.ico b/favicon.ico Binary files differnew file mode 100644 index 0000000..2db73db --- /dev/null +++ b/favicon.ico diff --git a/favicon.svg b/favicon.svg new file mode 100644 index 0000000..d8d3254 --- /dev/null +++ b/favicon.svg @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg version="2.0" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"> + <style> + path { + fill: black; + } + @media (prefers-color-scheme: dark) { + path { fill: white; } + } + </style> + <g dominant-baseline="central" fill="#8b0000" stroke-width="1.2517" aria-label="#"> + <path d="m138.71 12.498-16.272 64.933h38.334l16.429-64.933h25.034l-16.429 64.933h38.177v24.096h-43.967l-13.143 52.259h39.116v23.939h-45.218l-16.272 64.776h-25.034l16.429-64.776h-38.49l-16.429 64.776h-24.878l16.272-64.776h-40.368v-23.939h46.47l13.143-52.259h-41.62v-24.096h47.409l16.272-64.933zm16.272 89.028h-38.334l-13.143 52.259h38.49z"/> + </g> +</svg> diff --git a/package.json b/package.json new file mode 100644 index 0000000..f97db49 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "sudomsg", + "version": "1.0.0", + "description": "Website", + "scripts": { + "build": "eleventy", + "serve": "http-server dist/ -g", + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@11ty/eleventy": "^0.12.1", + "@11ty/eleventy-plugin-rss": "^1.1.1", + "@11ty/eleventy-plugin-syntaxhighlight": "^3.1.2", + "autoprefixer": "^10.3.4", + "cssnano": "^5.0.8", + "html-minifier": "^4.0.0", + "http-server": "^13.0.2", + "markdown-it-attrs": "^4.0.0", + "postcss": "^8.3.6", + "postcss-import": "^14.0.2", + "standard": "^16.0.3" + }, + "browserslist": [ + "defaults", + "not IE 11", + "maintained node versions" + ] +} diff --git a/src/about.md b/src/about.md new file mode 100644 index 0000000..4524f7a --- /dev/null +++ b/src/about.md @@ -0,0 +1,8 @@ +--- +layout: base.njk +title: About Me +tags: + - navigator +--- +# About Me + diff --git a/src/blog.njk b/src/blog.njk new file mode 100644 index 0000000..d2ac3e7 --- /dev/null +++ b/src/blog.njk @@ -0,0 +1,19 @@ +--- +layout: base.njk +title: Blog +tags: + - navigator +--- +<ul style="list-style-type:none"> +{% for post in collections.posts %} +<li> + <h1> + <a href="{{ post.url | url }}">{{ post.data.title }}</a> + </h1> + <small> + <p>{{ metadata.author.name }} - {{ post.data.date | datefmt }}<p> + </small> + <p>{{ post.data.description }}<p> +</li> +{% endfor %} +</ul> diff --git a/src/css.11ty.js b/src/css.11ty.js new file mode 100644 index 0000000..a3ef254 --- /dev/null +++ b/src/css.11ty.js @@ -0,0 +1,37 @@ +const fs = require('fs') +const path = require('path') +const postcss = require('postcss') + +module.exports = class { + async data() { + return { + inputs: [ + 'index.css', + 'prism.css' + ], + + pagination: { + data: 'inputs', + alias: 'inputfiles', + size: 1 + }, + + permalink: ({ inputfiles }) => `/${inputfiles}`, + + eleventyExcludeFromCollections: true + } + }; + + async render({ inputfiles}) { + const inputfile = path.join(__dirname, inputfiles); + return await postcss([ + require('postcss-import'), + require('autoprefixer'), + require('cssnano') + ]) + .process(await fs.readFileSync(inputfile), { + from: inputfile + }) + .then(result => result.css) + }; +} diff --git a/src/data/err.json b/src/data/err.json new file mode 100644 index 0000000..87e3603 --- /dev/null +++ b/src/data/err.json @@ -0,0 +1,166 @@ +[ + { + "code": "offline", + "msg": "The Page is offline" + }, + { + "code": 400, + "msg": "Bad Request" + }, + { + "code": 401, + "msg": "Unauthorized" + }, + { + "code": 402, + "msg": "Payment Required" + }, + { + "code": 403, + "msg": "Forbidden" + }, + { + "code": 404, + "msg": "Not Found" + }, + { + "code": 405, + "msg": "Method Not Allowed" + }, + { + "code": 406, + "msg": "Not Acceptable" + }, + { + "code": 407, + "msg": "Proxy Authentication Required" + }, + { + "code": 408, + "msg": "Request Timeout" + }, + { + "code": 409, + "msg": "Conflict" + }, + { + "code": 410, + "msg": "Gone" + }, + { + "code": 411, + "msg": "Length Required" + }, + { + "code": 412, + "msg": "Precondition Failed" + }, + { + "code": 413, + "msg": "Payload Too Large" + }, + { + "code": 414, + "msg": "URI Too Long" + }, + { + "code": 415, + "msg": "Unsupported Media Type" + }, + { + "code": 416, + "msg": "Range Not Satisfiable" + }, + { + "code": 417, + "msg": "Expectation Failed" + }, + { + "code": 418, + "msg": "I\"m a teapot" + }, + { + "code": 421, + "msg": "Misdirected Request" + }, + { + "code": 422, + "msg": "Unprocessable Entity" + }, + { + "code": 423, + "msg": "Locked" + }, + { + "code": 424, + "msg": "Failed Dependency" + }, + { + "code": 425, + "msg": "Too Early" + }, + { + "code": 426, + "msg": "Upgrade Required" + }, + { + "code": 428, + "msg": "Precondition Required" + }, + { + "code": 429, + "msg": "Too Many Requests" + }, + { + "code": 431, + "msg": "Request Header Fields Too Large" + }, + { + "code": 451, + "msg": "Unavailable For Legal Reasons" + }, + { + "code": 500, + "msg": "Internal Server Error" + }, + { + "code": 501, + "msg": "Not Implemented" + }, + { + "code": 502, + "msg": "Bad Gateway" + }, + { + "code": 503, + "msg": "Service Unavailable" + }, + { + "code": 504, + "msg": "Gateway Timeout" + }, + { + "code": 505, + "msg": "HTTP Version Not Supported" + }, + { + "code": 506, + "msg": "Variant Also Negotiates" + }, + { + "code": 507, + "msg": "Insufficient Storage" + }, + { + "code": 508, + "msg": "Loop Detected" + }, + { + "code": 510, + "msg": "Not Extended" + }, + { + "code": 511, + "msg": "Network Authentication Required" + } +]
\ No newline at end of file diff --git a/src/data/metadata.json b/src/data/metadata.json new file mode 100644 index 0000000..e2d7d6c --- /dev/null +++ b/src/data/metadata.json @@ -0,0 +1,12 @@ +{ + "title": "Sudomsg", + "url": "https://sudomsg.xyz/", + "language": "en-GB", + "description": "Messages from root", + "feed": "/feed.xml", + "author": { + "name": "Marc Pervaz Boocha", + "email": "mboocha@sudomsg.xyz", + "url": "https://sudomsg.xyz/about" + } +} diff --git a/src/data/navigator.json b/src/data/navigator.json new file mode 100644 index 0000000..5fb27a7 --- /dev/null +++ b/src/data/navigator.json @@ -0,0 +1,14 @@ +[ + { + "url": "/", + "title": "Home" + }, + { + "url": "/blog/", + "title": "Blog" + }, + { + "url": "/about/", + "title": "About" + } +] diff --git a/src/error.md b/src/error.md new file mode 100644 index 0000000..a84fe07 --- /dev/null +++ b/src/error.md @@ -0,0 +1,12 @@ +--- +layout: base.njk +pagination: + data: err + size: 1 + alias: error +permalink: "/{{ error.code }}.html" +eleventyExcludeFromCollections: true +--- +# ERROR: {{ error.code }} {.err} + +{{ error.msg }} diff --git a/src/feed.njk b/src/feed.njk new file mode 100644 index 0000000..120c33b --- /dev/null +++ b/src/feed.njk @@ -0,0 +1,27 @@ +--- +permalink: /feed.xml +eleventyExcludeFromCollections: true +--- +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + <title>{{ metadata.title }}</title> + <subtitle>{{ metadata.description }}</subtitle> + <link href="{{ permalink | url | absoluteUrl(metadata.url) }}" rel="self"/> + <link href="{{ "/" | url | absoluteUrl(metadata.url) }}"/> + <updated>{{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }}</updated> + <id>{{ metadata.url }}</id> + <author> + <name>{{ metadata.author.name }}</name> + <email>{{ metadata.author.email }}</email> + </author> + {% for post in collections.posts %} + {% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %} + <entry> + <title>{{ post.data.title }}</title> + <link href="{{ absolutePostUrl }}"/> + <updated>{{ post.date | dateToRfc3339 }}</updated> + <id>{{ '/' | url | absoluteUrl(metadata.url) }}</id> + <content type="html">{{ post.templateContent | htmlToAbsoluteUrls( absolutePostUrl ) }}</content> + </entry> + {% endfor %} +</feed> diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..a55d276 --- /dev/null +++ b/src/index.css @@ -0,0 +1,62 @@ +:root { + font-family: sans-serif; +} + +@media screen { + + body { + max-width: 920px; + margin: auto; + padding: 0.5rem; + } + + :any-link { + color: inherit; + text-decoration: underline; + } + + .menu :any-link { + text-decoration: inherit; + } + + .menu ul { + background: darkred; + color: white; + padding: 1rem; + font-size: 1rem; + } + + .menu li { + display: inline; + margin-right: 1rem; + padding-left: 0rem; + padding-right: 0rem; + } + + .err { + color: darkred; + } + + @media (prefers-color-scheme: dark) { + :root { + background: black; + color: white; + } + + .menu ul { + background: red; + } + + .err { + color: red; + } + + } +} + +@media print { + header,nav,footer{ + display:none; + } +} + diff --git a/src/index.md b/src/index.md new file mode 100644 index 0000000..01346a5 --- /dev/null +++ b/src/index.md @@ -0,0 +1,11 @@ +--- +layout: base.njk +title: Home +tags: + - navigator +--- + +# About This Blog + +This is my special place on the big World Wide Web + diff --git a/src/js.11ty.js b/src/js.11ty.js new file mode 100644 index 0000000..b4b04c7 --- /dev/null +++ b/src/js.11ty.js @@ -0,0 +1,35 @@ +const fs = require('fs') +const path = require('path') +const postcss = require('postcss') + +module.exports = class { + async data() { + return { + inputs: [ + ], + + pagination: { + data: 'inputs', + alias: 'inputfiles', + size: 1 + }, + + permalink: ({ inputfiles }) => `/${inputfiles}.css`, + + eleventyExcludeFromCollections: true + } + }; + + async render({ inputfiles}) { + const inputfile = path.join(__dirname, inputfiles); + return await postcss([ + require('postcss-import'), + require('autoprefixer'), + require('cssnano') + ]) + .process(await fs.readFileSync(inputfile), { + from: inputfile + }) + .then(result => result.css) + }; +} diff --git a/src/layouts/base.njk b/src/layouts/base.njk new file mode 100644 index 0000000..10e448f --- /dev/null +++ b/src/layouts/base.njk @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html lang="en-GB"> + <head> + <meta charset="utf-8"> + <title>{{ title or metadata.title }}</title> + <meta name="author" content="{{ metadata.author.name }}"> + <meta name="description" content="{{ description or metadata.description }}"> + <meta name="generator" contents="eleventy"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link async rel="icon" href="{{ '/favicon.svg' | url }}" type="image/svg+xml"> + <link rel="alternate" href="{{ metadata.feed | url }}" type="application/atom+xml" title="{{ metadata.title }}"> + <link rel="canonical" href="{{ page.url | url | absoluteUrl(metadata.url) }}"/> + <link as="style" href="{{ '/index.css' | url }}" rel="stylesheet"/> + <link as="style" href="{{ '/prism.css' | url }}" rel="stylesheet"> + </head> + <body> + <header> + <nav class="menu"><ul> + {% for nav in navigator %} + <li><a href="{{ nav.url | url }}">{{ nav.title }}</a></li> + {% endfor %} + </ul></nav> + </header> + <main> + {{ content | safe }} + </main> + </body> +</html> + diff --git a/src/layouts/post.njk b/src/layouts/post.njk new file mode 100644 index 0000000..b2eb5e5 --- /dev/null +++ b/src/layouts/post.njk @@ -0,0 +1,12 @@ +--- +layout: base.njk +tags: + - posts +--- +<article> + <h1>{{ title }}</h1> + <small> + <time datetime="{{ date | datefmt }}">{{ date | datefmt }}</time> - {{ metadata.author.name }} + </small> + {{ content | safe }} +</article> diff --git a/src/post/hello_world.md b/src/post/hello_world.md new file mode 100644 index 0000000..923ad0b --- /dev/null +++ b/src/post/hello_world.md @@ -0,0 +1,8 @@ +--- +title: Hello World +description: The First Post to the World +date: 2021-09-12 +--- +This is the first post on my blog. + +Eleventy is super fresh init. diff --git a/src/post/post.json b/src/post/post.json new file mode 100644 index 0000000..60ff6df --- /dev/null +++ b/src/post/post.json @@ -0,0 +1,3 @@ +{ + "layout": "post.njk" +}
\ No newline at end of file diff --git a/src/prism.css b/src/prism.css new file mode 100644 index 0000000..431fe8a --- /dev/null +++ b/src/prism.css @@ -0,0 +1,130 @@ +code[class*="language-"],pre[class*="language-"] { + color: #f8f8f2; + background: none; + text-shadow: 0 1px rgba(0, 0, 0, 0.3); + font-family: monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + tab-size: 4; + hyphens: none; +} + +/* Code blocks */ +pre[class*="language-"] { + padding: 1em; + margin: .5em 0; + overflow: auto; + border-radius: 0.3em; +} + +:not(pre) > code[class*="language-"],pre[class*="language-"] { + background: #272822; +} + +/* Inline code */ +:not(pre) > code[class*="language-"] { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.token.comment,.token.prolog,.token.doctype,.token.cdata { + color: #8292a2; +} + +.token.punctuation { + color: #f8f8f2; +} + +.token.namespace { + opacity: .7; +} + +.token.property,.token.tag,.token.constant,.token.symbol,.token.deleted { + color: #f92672; +} + +.token.boolean,.token.number { + color: #ae81ff; +} + +.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted { + color: #a6e22e; +} + +.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string,.token.variable { + color: #f8f8f2; +} + +.token.atrule,.token.attr-value,.token.function,.token.class-name { + color: #e6db74; +} + +.token.keyword { + color: #66d9ef; +} + +.token.regex,.token.important { + color: #fd971f; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +@media screen and (prefers-color-scheme: dark){ + code[class*="language-"],pre[class*="language-"] { + color: black; + text-shadow: 0 1px white; + } + + :not(pre) > code[class*="language-"], pre[class*="language-"] { + background: #f5f2f0; + } + + .token.comment,.token.prolog,.token.doctype,.token.cdata { + color: slategray; + } + + .token.punctuation { + color: #999; + } + + .token.property,.token.tag,.token.boolean,.token.number,.token.constant,.token.symbol,.token.deleted { + color: #905; + } + + .token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted { + color: #690; + } + + .token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5); + } + + .token.atrule,.token.attr-value,.token.keyword { + color: #07a; + } + + .token.function,.token.class-name { + color: #DD4A68; + } + + .token.regex,.token.important,.token.variable { + color: #e90; + } +}
\ No newline at end of file diff --git a/src/robot.njk b/src/robot.njk new file mode 100644 index 0000000..79c49c0 --- /dev/null +++ b/src/robot.njk @@ -0,0 +1,7 @@ +--- +permalink: /robot.txt +eleventyExcludeFromCollections: true +--- +User-agent: * +Allow: / +Sitemap: {{ "/"| url | absoluteUrl(metadata.url) }}/sitemap.xml
\ No newline at end of file diff --git a/src/sitemap.njk b/src/sitemap.njk new file mode 100644 index 0000000..b2ff291 --- /dev/null +++ b/src/sitemap.njk @@ -0,0 +1,15 @@ +--- +permalink: /sitemap.xml +eleventyExcludeFromCollections: true +--- +<?xml version="1.0" encoding="utf-8"?> +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> +{%- for page in collections.all %} + {% set absoluteUrl %}{{ page.url | url | absoluteUrl(metadata.url) }}{% endset %} + <url> + <loc>{{ absoluteUrl }}</loc> + <lastmod>{{ page.date | datefmt }}</lastmod> + </url> +{%- endfor %} +</urlset> + |