Skip to content

Meta tags

Meta tags #39

Workflow file for this run

# Simple workflow for deploying static content to GitHub Pages
#im too dum for this thx chatgpt
name: Deploy static content to Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js (or Python if preferred)
uses: actions/setup-node@v3
with:
node-version: '16' # Adjust based on your needs
- name: Inject Analytics Script
run: |
# Create a simple Node.js script to modify HTML files
cat << 'EOF' > inject-script.js
const fs = require('fs');
const path = require('path');
const directory = '.'; // Adjust if needed
const scriptTag = '<script defer src="https://cloud.umami.is/script.js" data-website-id="2941b949-acb6-4980-bc87-a80358b82838"></script>';
const injectScript = (filePath) => {
const content = fs.readFileSync(filePath, 'utf-8');
if (!content.includes(scriptTag)) {
const modified = content.replace('</head>', `${scriptTag}\n</head>`);
fs.writeFileSync(filePath, modified, 'utf-8');
}
};
const walkDirectory = (dir) => {
fs.readdirSync(dir).forEach((file) => {
const fullPath = path.join(dir, file);
if (fs.statSync(fullPath).isDirectory()) {
walkDirectory(fullPath);
} else if (fullPath.endsWith('.html')) {
injectScript(fullPath);
}
});
};
walkDirectory(directory);
EOF
node inject-script.js
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4