From cd2995d01ac20a14bcec72e083fb186cc368eb88 Mon Sep 17 00:00:00 2001 From: "Eric J. Smith" Date: Sat, 18 Sep 2021 12:09:12 -0500 Subject: [PATCH 01/16] Converting site to lume --- .eleventy.js | 211 - .github/workflows/build.yml | 33 + .gitignore | 6 +- .nvmrc | 1 - .vscode/launch.json | 20 +- .vscode/lume_import_map.json | 5 + .vscode/settings.json | 40 +- .vscode/tasks.json | 47 +- README.md | 2 - _config.ts | 31 + content/404.md | 5 +- content/_data/eleventyComputed.js | 44 - content/_data/site.json | 9 - content/_data/site.yml | 8 + content/_includes/docs-toc.html | 4 - content/_includes/layouts/archive.njk | 30 + .../layouts}/content-well.njk | 2 +- .../layouts}/content.njk | 2 +- .../layouts}/default.njk | 7 +- .../{_layouts => _includes/layouts}/docs.njk | 4 +- .../{_layouts => _includes/layouts}/post.njk | 2 +- content/_includes/layouts/tag.njk | 12 + content/_includes/layouts/template/base.njk | 43 + content/_includes/layouts/template/home.njk | 16 + content/_includes/layouts/template/post.njk | 43 + .../{carousel.html => templates/carousel.njk} | 0 content/_includes/templates/docs-toc.njk | 4 + content/_includes/{ => templates}/head.njk | 5 +- .../_includes/{ => templates}/intercom.njk | 0 content/_includes/templates/postslist.njk | 25 + content/about.md | 6 +- content/admin/config.tmpl.js | 88 + content/admin/index.njk | 21 + content/archive.tmpl.js | 28 + content/assets/js/searcher/searcher.js | 231 + content/content.json | 5 - content/docs/_data.yml | 2 + content/docs/docs.json | 4 - content/feed.njk | 30 - content/feed.tmpl.js | 28 + content/feed.xml.njk | 24 + content/{index.html => index.njk} | 9 +- content/{news.html => news.njk} | 1 + ...coming-exceptionless-2-0-simplified-api.md | 3 +- ...g-move-elastic-search-exceptionless-2-0.md | 3 +- content/news/_data.yml | 2 + content/news/news.json | 5 - content/{pricing.html => pricing.njk} | 1 + content/privacy.md | 2 +- content/{_redirects.njk => redirects.njk} | 3 +- content/robots.njk | 7 - content/robots.txt.njk | 3 + content/{search.html => search.njk} | 2 +- content/search.tmpl.js | 22 + content/sitemap.njk | 6 - content/sitemap.xml.njk | 9 + content/tag.tmpl.js | 12 + content/tags.njk | 8 + content/terms.md | 2 +- content/{tour.html => tour.njk} | 1 + content/{why.html => why.njk} | 2 +- m2json.js | 89 - netlify.toml | 9 + new_post.js | 51 - package-lock.json | 9420 ----------------- package.json | 40 - 66 files changed, 820 insertions(+), 10020 deletions(-) delete mode 100644 .eleventy.js create mode 100644 .github/workflows/build.yml delete mode 100644 .nvmrc create mode 100644 .vscode/lume_import_map.json create mode 100644 _config.ts delete mode 100644 content/_data/eleventyComputed.js delete mode 100644 content/_data/site.json create mode 100644 content/_data/site.yml delete mode 100644 content/_includes/docs-toc.html create mode 100644 content/_includes/layouts/archive.njk rename content/{_layouts => _includes/layouts}/content-well.njk (91%) rename content/{_layouts => _includes/layouts}/content.njk (88%) rename content/{_layouts => _includes/layouts}/default.njk (98%) rename content/{_layouts => _includes/layouts}/docs.njk (94%) rename content/{_layouts => _includes/layouts}/post.njk (97%) create mode 100644 content/_includes/layouts/tag.njk create mode 100644 content/_includes/layouts/template/base.njk create mode 100644 content/_includes/layouts/template/home.njk create mode 100644 content/_includes/layouts/template/post.njk rename content/_includes/{carousel.html => templates/carousel.njk} (100%) create mode 100644 content/_includes/templates/docs-toc.njk rename content/_includes/{ => templates}/head.njk (89%) rename content/_includes/{ => templates}/intercom.njk (100%) create mode 100644 content/_includes/templates/postslist.njk create mode 100644 content/admin/config.tmpl.js create mode 100644 content/admin/index.njk create mode 100644 content/archive.tmpl.js create mode 100644 content/assets/js/searcher/searcher.js delete mode 100644 content/content.json create mode 100644 content/docs/_data.yml delete mode 100644 content/docs/docs.json delete mode 100644 content/feed.njk create mode 100644 content/feed.tmpl.js create mode 100644 content/feed.xml.njk rename content/{index.html => index.njk} (98%) rename content/{news.html => news.njk} (97%) create mode 100644 content/news/_data.yml delete mode 100644 content/news/news.json rename content/{pricing.html => pricing.njk} (99%) rename content/{_redirects.njk => redirects.njk} (99%) delete mode 100644 content/robots.njk create mode 100644 content/robots.txt.njk rename content/{search.html => search.njk} (98%) create mode 100644 content/search.tmpl.js delete mode 100644 content/sitemap.njk create mode 100644 content/sitemap.xml.njk create mode 100644 content/tag.tmpl.js create mode 100644 content/tags.njk rename content/{tour.html => tour.njk} (99%) rename content/{why.html => why.njk} (99%) delete mode 100644 m2json.js create mode 100644 netlify.toml delete mode 100644 new_post.js delete mode 100644 package-lock.json delete mode 100644 package.json diff --git a/.eleventy.js b/.eleventy.js deleted file mode 100644 index 6aa31755..00000000 --- a/.eleventy.js +++ /dev/null @@ -1,211 +0,0 @@ -const pluginRss = require("@11ty/eleventy-plugin-rss"); -const slugify = require("slugify"); -const embedEverything = require("eleventy-plugin-embed-everything"); -const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); -const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); -const path = require('path'); -const sitemap = require("@quasibit/eleventy-plugin-sitemap"); - -module.exports = function (eleventyConfig) { - if(!process.env.ELEVENTY_PRODUCTION) { - eleventyConfig.setQuietMode(true); - } - - eleventyConfig.setBrowserSyncConfig({ - ui: false, - ghostMode: false - }); - - eleventyConfig.addPlugin(pluginRss); - eleventyConfig.addPlugin(embedEverything); - eleventyConfig.addPlugin(syntaxHighlight); - eleventyConfig.addPlugin(eleventyNavigationPlugin); - eleventyConfig.addPlugin(sitemap, { - sitemap: { - hostname: "https://exceptionless.com", - }, - }); - - eleventyConfig.addPassthroughCopy("content/assets"); - eleventyConfig.addPassthroughCopy("content/favicon.ico"); - eleventyConfig.addPassthroughCopy("content/**/*.jpg"); - eleventyConfig.addPassthroughCopy("content/**/*.png"); - eleventyConfig.addPassthroughCopy("content/**/*.gif"); - eleventyConfig.addPassthroughCopy("content/_redirects"); - - eleventyConfig.setDataDeepMerge(true); - - // ------------------------------------------------------------------------ - // Markdown plugins - // ------------------------------------------------------------------------ - - const markdownIt = require('markdown-it'); - - const markdownItOptions = { - html: true, - breaks: true, - linkify: false, - replaceLink: function (link, env) { - const doNothing = ['http://', 'https://', '/', '#', 'mailto:']; - if (doNothing.some((protocol) => link.startsWith(protocol))) - return link; - - let dir = path.dirname(env.page?.filePathStem ?? ''); - let fullPath = dir + '/' + link; - - fullPath = fullPath.replace(/index.md$/, '').replace(/.md$/, '/'); - - return fullPath; - } - }; - - const markdownItFootnote = require('markdown-it-footnote'); - - const markdownItAnchor = require('markdown-it-anchor'); - - const markdownItAnchorOptions = { - permalink: true, - permalinkClass: 'deeplink', - permalinkSymbol: '#', - level: [2, 3, 4], - slugify: function (s) { - return slugify(s, { - replacement: "-", - remove: /[*+~()'"!:@]/g, - lower: true, - strict: true, - }); - }, - }; - - const markdownItAttributes = require('markdown-it-attrs'); - - const markdownItSpan = require('markdown-it-bracketed-spans'); - - const markdownItAlerts = require('markdown-it-alerts'); - - const markdownItAbbr = require('markdown-it-abbr'); - - const markdownItReplaceLink = require('markdown-it-replace-link'); - - function getHeadingLevel(tagName) { - if (tagName[0].toLowerCase() === 'h') { - tagName = tagName.slice(1); - } - - return parseInt(tagName, 10); - } - - function markdownItHeadingLevel(md, options) { - var firstLevel = options.firstLevel; - - if (typeof firstLevel === 'string') { - firstLevel = getHeadingLevel(firstLevel); - } - - if (!firstLevel || isNaN(firstLevel)) { - return; - } - - var levelOffset = firstLevel - 1; - if (levelOffset < 1 || levelOffset > 6) { - return; - } - - md.core.ruler.push('adjust-heading-levels', function (state) { - var tokens = state.tokens; - for (var i = 0; i < tokens.length; i++) { - if (tokens[i].type !== 'heading_close') { - continue; - } - - var headingOpen = tokens[i - 2]; - var headingClose = tokens[i]; - - var currentLevel = getHeadingLevel(headingOpen.tag); - var tagName = 'h' + Math.min(currentLevel + levelOffset, 6); - - headingOpen.tag = tagName; - headingClose.tag = tagName; - } - }); - } - - const md = markdownIt(markdownItOptions) - .disable('code') - .use(markdownItHeadingLevel, { firstLevel: 2 }) - .use(markdownItFootnote) - .use(markdownItAnchor, markdownItAnchorOptions) - .use(markdownItAttributes) - .use(markdownItSpan) - .use(markdownItAbbr) - .use(markdownItReplaceLink) - .use(markdownItAlerts); - - md.renderer.rules.table_open = function(tokens, idx) { - return ''; - }; - - const m2j = require('./m2json'); - const glob = require('glob'); - const options = { - minify: false, - width: 70, - outfile: './content/assets/index.json', - content: true - }; - // Read all markdown files - glob('./content/docs/**/*.md', function(er, files) { - m2j.parse(files, options); - }); - - - eleventyConfig.setLibrary('md', md); - - eleventyConfig.addFilter('markdownify', (markdownString) => - md.render(markdownString) - ); - - eleventyConfig.addFilter("slug", function (value) { - return slugify(value, { - replacement: "-", - remove: /[*+~()'"!:@]/g, - lower: true, - strict: true, - }); - }); - - eleventyConfig.addNunjucksFilter("json", function (value) { - if (!value) return ""; - - const getCircularReplacer = () => { - const seen = new WeakSet(); - return (key, value) => { - if (typeof value === "object" && value !== null) { - if (seen.has(value)) { - return; - } - seen.add(value); - } - return value; - }; - }; - - return JSON.stringify(value, getCircularReplacer(), 4); - }); - - return { - templateFormats: ["html", "md", "njk", "json"], - - markdownTemplateEngine: "njk", - htmlTemplateEngine: "njk", - dataTemplateEngine: "njk", - dir: { - output: "_site", - data: "_data", - input: "content", - includes: "_includes", - layouts: "_layouts", - }, - }; -}; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..ead1360c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Publish + +on: + push: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Deno environment + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + + - name: Install lume + run: | + deno run -A https://deno.land/x/lume/install.ts + lume upgrade --dev + + - name: Run lume + run: | + lume --location=https://exceptionless.github.io/website/ + + - name: Deploy + uses: crazy-max/ghaction-github-pages@v2 + with: + build_dir: _site + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index fddfe8d4..1c563ae2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -node_modules/ -_site/ -.idea -content/assets/index.json +.DS_Store +_site \ No newline at end of file diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 19c7bdba..00000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -16 \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index e7301e11..ee481805 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,13 +1,21 @@ { + "version": "0.2.0", "configurations": [ { - "type": "node", "request": "launch", - "name": "Launch 11ty", - "program": "${workspaceFolder}\\node_modules\\@11ty\\eleventy\\cmd.js", - "args": [ - // "--output=C:\\Temp" - ] + "name": "Lume build", + "type": "pwa-node", + "program": "${workspaceFolder}/_config.ts", + "cwd": "${workspaceFolder}", + "runtimeExecutable": "deno", + "runtimeArgs": [ + "run", + "--unstable", + "--import-map=.vscode/lume_import_map.json", + "--inspect", + "--allow-all" + ], + "attachSimplePort": 9229 } ] } \ No newline at end of file diff --git a/.vscode/lume_import_map.json b/.vscode/lume_import_map.json new file mode 100644 index 00000000..3b65f18b --- /dev/null +++ b/.vscode/lume_import_map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "https://deno.land/x/lume/": "https:/cdn.jsdelivr.net/gh/lumeland/lume@520ef01ff133adaec5c99a162b7c30d244217069/" + } +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 8e3bb757..b8b086e2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,36 +1,8 @@ { - "cSpell.words": [ - "Aliyun", - "Burcham", - "Foundatio", - "Geocode", - "Gmail", - "Kibana", - "Kubernetes", - "Lucene", - "Minio", - "OWIN", - "Reindex", - "Reindexing", - "Serilog", - "Trello", - "Varorbc", - "Zurb", - "Zurb's", - "adamsitnik", - "angularjs", - "caesay", - "deduplicated", - "deduplicating", - "edwardmeng", - "eleventy", - "exceptionless", - "frankebersoll", - "kubectl", - "pluggable", - "serializers", - "srijken", - "typeof", - "walkthrough" - ] + "deno.enable": true, + "deno.lint": true, + "deno.unstable": true, + "deno.suggest.imports.hosts": { + "https://cdn.skypack.dev": false + } } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 4b3a56c3..fc8aabe4 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,30 +1,31 @@ { "version": "2.0.0", "tasks": [ - { - "type": "npm", - "script": "dev", - "problemMatcher": [], - "label": "npm: dev", - "detail": "npx @11ty/eleventy --serve" - }, - { - "type": "npm", - "script": "build", - "group": { + { + "label": "Lume build", + "type": "shell", + "command": "lume", + "group": { "isDefault": true, "kind": "build" }, - "problemMatcher": [], - "label": "npm: build", - "detail": "npx @11ty/eleventy" - }, - { - "type": "npm", - "script": "install", - "problemMatcher": [], - "label": "npm: install", - "detail": "install dependencies from package" - } - ] + "presentation": { + "reveal": "always", + "panel": "dedicated" + } + }, + { + "label": "Lume serve", + "type": "shell", + "command": "lume", + "args": [ + "--serve" + ], + "group": "build", + "presentation": { + "reveal": "always", + "panel": "dedicated" + } + } + ] } \ No newline at end of file diff --git a/README.md b/README.md index 124bd8dd..293f255c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ ## Exceptionless Marketing Site -*Under Construction* - ## Creating New Posts You can manually create a new markdown file for your posts and ensure the front matter is correct, or you can run the following command from within the project directory: diff --git a/_config.ts b/_config.ts new file mode 100644 index 00000000..39147c0b --- /dev/null +++ b/_config.ts @@ -0,0 +1,31 @@ +import lume from "https://deno.land/x/lume/mod.ts"; +import date from "https://deno.land/x/lume/plugins/date.ts"; +import postcss from "https://deno.land/x/lume/plugins/postcss.ts"; +import terser from "https://deno.land/x/lume/plugins/terser.ts"; +import codeHighlight from "https://deno.land/x/lume/plugins/code_highlight.ts"; +import basePath from "https://deno.land/x/lume/plugins/base_path.ts"; +import slugifyUrls from "https://deno.land/x/lume/plugins/slugify_urls.ts"; +import gpm from "https://deno.land/x/gpm@v0.2.0/mod.ts"; + +const site = lume({ + location: new URL("https://exceptionless.com/"), + src: "content", +}); + +site + .ignore("README.md") + .copy("assets") + .use(postcss()) + .use(terser()) + .use(date()) + .use(codeHighlight()) + .use(basePath()) + .use(slugifyUrls({ alphanumeric: false })) + .addEventListener( + "beforeBuild", + () => gpm(["oom-components/searcher"], "content/assets/js"), + ); + +export default site; + +if (import.meta.main) site.build(); \ No newline at end of file diff --git a/content/404.md b/content/404.md index 090b06bc..9decf8da 100644 --- a/content/404.md +++ b/content/404.md @@ -1,8 +1,7 @@ --- title: Not Found -layout: content-well -permalink: 404.html -eleventyExcludeFromCollections: true +layout: layouts/content-well.njk +url: /404.html --- Sorry, but the page you were trying to view does not exist. diff --git a/content/_data/eleventyComputed.js b/content/_data/eleventyComputed.js deleted file mode 100644 index 31092ef1..00000000 --- a/content/_data/eleventyComputed.js +++ /dev/null @@ -1,44 +0,0 @@ -module.exports = { - eleventyNavigation: { - key: (data) => { - const urlParts = data.page.url.split("/"); - - const pathDirs = urlParts.slice(1, urlParts.length - 1); - const path = pathDirs.join("/"); - return data.key || path; - }, - title: (data) => data.title, - parent: (data) => { - const urlParts = data.page.url.split("/"); - - const parentDirs = urlParts.slice(1, urlParts.length - 2); - const parent = parentDirs.join("/"); - - return data.parent || parent; - }, - order: (data) => data.order, - }, - eleventyComputed: { - /** - * Adds support for drafts. - * If a page has `draft: true` in its YAML frontmatter then this snippet - * will set its permalink to false and exclude it from collections. - * - * For dev builds we will always render the page. - */ - permalink: data => { - if (data.draft) { - return false; - } - - return data.permalink; - }, - eleventyExcludeFromCollections: data => { - if (data.draft) { - return true; - } - - return false; - } - } -}; \ No newline at end of file diff --git a/content/_data/site.json b/content/_data/site.json deleted file mode 100644 index d4fa5b53..00000000 --- a/content/_data/site.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "title": "Exceptionless", - "description": "Real-time exception reporting for ASP.NET, Web API, WebForms, WPF, Console, and MVC applications. Includes event organization, notifications, and more.", - "url": "https://exceptionless.com", - "author": "Exceptionless Team", - "twitter": "Exceptionless", - "analyticsId": "UA-433340-8", - "intercomId": "6c0d76e0bec950052459f5cb4b727a949aeabbe1" -} \ No newline at end of file diff --git a/content/_data/site.yml b/content/_data/site.yml new file mode 100644 index 00000000..5288605f --- /dev/null +++ b/content/_data/site.yml @@ -0,0 +1,8 @@ +title: Exceptionless +description: Real-time exception reporting for ASP.NET, Web API, WebForms, WPF, Console, and MVC applications. Includes event organization, notifications, and more. +author: + name: Exceptionless Team + email: team@exceptionless.com +twitter: Exceptionless +analyticsId: UA-433340-8 +intercomId: 6c0d76e0bec950052459f5cb4b727a949aeabbe1 diff --git a/content/_includes/docs-toc.html b/content/_includes/docs-toc.html deleted file mode 100644 index 4e746a77..00000000 --- a/content/_includes/docs-toc.html +++ /dev/null @@ -1,4 +0,0 @@ -{%- if eleventyNavigation -%} - {%- set navKey = eleventyNavigation.key -%} -{%- endif -%} -{{ collections.docs | eleventyNavigation | eleventyNavigationToHtml({ activeKey: navKey, listClass: 'toc-list', activeListItemClass: 'toc-active' }) | safe }} diff --git a/content/_includes/layouts/archive.njk b/content/_includes/layouts/archive.njk new file mode 100644 index 00000000..e6c44907 --- /dev/null +++ b/content/_includes/layouts/archive.njk @@ -0,0 +1,30 @@ +--- +layout: layouts/content.njk +bodyClass: body-tag +--- +

{{ title }}

+ +{% set postslist = results %} +{% include "templates/postslist.njk" %} + +
+ + \ No newline at end of file diff --git a/content/_layouts/content-well.njk b/content/_includes/layouts/content-well.njk similarity index 91% rename from content/_layouts/content-well.njk rename to content/_includes/layouts/content-well.njk index a16dd9b2..c8cbd291 100644 --- a/content/_layouts/content-well.njk +++ b/content/_includes/layouts/content-well.njk @@ -1,5 +1,5 @@ --- -layout: default +layout: layouts/default.njk ---