Skip to content
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

Basic Implementation of Netlify CMS #20

Merged
merged 10 commits into from
Sep 15, 2022
6 changes: 5 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ const { minify: cleanHtml } = require("html-minifier-terser");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const { getTOC } = require("./_lib/toc");

const isProduction = process.env.NODE_ENV === 'production';

async function minifyHtml(source, output_path) {
if (!output_path.endsWith(".html")) return source;
if (!output_path.endsWith(".html") || !isProduction) return source;

const result = await cleanHtml(source, {
collapseBooleanAttributes: true,
Expand Down Expand Up @@ -84,6 +86,8 @@ module.exports = (config) => {
const html = (...args) => outdent(String.raw(...args)).trim();

config.addPassthroughCopy("assets/**/*");
config.addPassthroughCopy("admin/config.yml");
config.addPassthroughCopy("admin/*.css");

// Old paths
config.addPassthroughCopy({ "./assets": "/" });
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies & build
env:
NODE_ENV: production
run: |
npm ci
npm run build
Expand Down
5 changes: 5 additions & 0 deletions _includes/components/section-menu.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
{% set hideChildren = true %}
{% endif %}

{# Special case of pages/URLs with the same starting slug #}
{% if (not hideChildren) and (page.key === "/hilfe/handbuch/mitarbeiter-app" or page.key === "/hilfe/handbuch/mitarbeiter") and (eleventyNavigation.key === "/hilfe/handbuch/mitarbeiter-app" or eleventyNavigation.key === "/hilfe/handbuch/mitarbeiter") and (page.key !== eleventyNavigation.key) %}
{% set hideChildren = true %}
{% endif %}

{% if hideChildren %}
{% set hiddenAttribute = "hidden" %}
{% endif %}
Expand Down
Loading