diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml deleted file mode 100644 index 1787227..0000000 --- a/.github/workflows/build-and-deploy.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build and Deploy - -on: - push: - branches: ['master'] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: ['20'] - - permissions: - contents: write - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - - name: Install packages - run: npm ci - - - name: Run npm build - run: npm run build:prod - - - name: Deploy to gh-pages - uses: peaceiris/actions-gh-pages@v4 - with: - deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index fc23937..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Build PR - -on: - pull_request: - branches: ['main'] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: ['20'] - - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - - name: Install packages - run: npm ci - - - name: Run npm build - run: npm run build \ No newline at end of file diff --git a/eleventy.config.js b/eleventy.config.js index 1b052a1..5822778 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -3,11 +3,12 @@ import fs from 'fs'; import path from 'path'; let allPlugins = []; +const isProd = process.env.ELEVENTY_ENV === "production"; +const pathPrefix = isProd ? "/neoBeta/" : "/"; export default function (eleventyConfig) { eleventyConfig.setInputDirectory("src"); eleventyConfig.setOutputDirectory("public"); - eleventyConfig.addPassthroughCopy("src/projects/**/*.png"); eleventyConfig.addPassthroughCopy("src/projects/**/*.jpg"); eleventyConfig.addPassthroughCopy("src/projects/**/*.jpeg"); @@ -15,11 +16,13 @@ export default function (eleventyConfig) { eleventyConfig.addPassthroughCopy("src/authors/**/*.jpg"); eleventyConfig.addPassthroughCopy("src/authors/**/*.jpeg"); eleventyConfig.addPassthroughCopy("src/assets"); - eleventyConfig.addPassthroughCopy({ "favicon/*" : "/" }); + eleventyConfig.addPassthroughCopy({ "src/favicon/*" : "/" }); eleventyConfig.addCollection("projects", function(collection) { - return collection.getFilteredByGlob("src/projects/**/*.md"); + return collection.getFilteredByGlob("src/projects/*/*.md"); }); + + eleventyConfig.addGlobalData("pathPrefix", pathPrefix) eleventyConfig.addGlobalData("eleventyComputed", { projectData: (data) => { @@ -34,11 +37,14 @@ export default function (eleventyConfig) { } return { name: path.basename(projectDir) }; }, - layout: (data) => { const inputPath = data.page.inputPath; if (inputPath.match(/\/projects\/[^\/]+\/docs\//)) return "docs.njk"; return data.layout; + }, + projectSlug: data => { + const url = data.page?.url || data.page?.filePathStem || ""; + return url.replace(/\/$/,'').split('/').filter(Boolean).pop() || null; } }); @@ -70,4 +76,9 @@ export default function (eleventyConfig) { fs.writeFileSync('./public/search_index.json', JSON.stringify(idx)); }); + + return { + pathPrefix + } + }; diff --git a/src/_includes/docs.njk b/src/_includes/docs.njk index e78c540..15d4ec0 100644 --- a/src/_includes/docs.njk +++ b/src/_includes/docs.njk @@ -2,7 +2,7 @@ layout: skeleton.njk ---
-

You are seeing the documentation for: {{ projectData.fileSlug }}

+

You are seeing the documentation for: {{ projectData.fileSlug }}


{{ content | safe }} diff --git a/src/_includes/featured.njk b/src/_includes/featured.njk index 39fc587..d532513 100644 --- a/src/_includes/featured.njk +++ b/src/_includes/featured.njk @@ -6,12 +6,16 @@ {% if item.fileSlug == project %} {% set projectData = item %} diff --git a/src/_includes/header.njk b/src/_includes/header.njk index 2233c47..d9f87e0 100644 --- a/src/_includes/header.njk +++ b/src/_includes/header.njk @@ -2,14 +2,14 @@