بص بحاول ارفع موقع انشاته من تمبلت من جت هب وخلصته...
Erstellt am: 26. August 2025
Beantwortet mit GPT-5 Thinking von Chat01
Erstellt am: 26. August 2025
Beantwortet mit GPT-5 Thinking von Chat01
بص بحاول ارفع موقع انشاته من تمبلت من جت هب وخلصته مع شات تاني بس في مشاكل في الرفع بص اخر احاجه ظهرت في تريمنال
metadata.url = https://YousefMohamd.github.io
Yousef@Apples-MacBook-Pro my-portfolio % node -e "const fs=require('fs');const p='_data/metadata.json';let j=fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{author:{}};j.url=j.url||'https://yousefmohamd.github.io';fs.writeFileSync(p,JSON.stringify(j,null,2));console.log('metadata.url =',j.url)"
metadata.url = https://YousefMohamd.github.io
Yousef@Apples-MacBook-Pro my-portfolio % git commit -m "Upgrade Eleventy to v2 + enable RSS filters"
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
modified: .eleventy.js
modified: package.json
no changes added to commit
Yousef@Apples-MacBook-Pro my-portfolio % git push origin main
Everything up-to-date
Yousef@Apples-MacBook-Pro my-portfolio %
applypatch << 'EOF'
*** Begin Patch
*** Update File: .eleventy.js
@@
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
zsh: command not found: applypatch
Yousef@Apples-MacBook-Pro my-portfolio % applypatch << 'EOF'
*** Begin Patch
*** Update File: .eleventy.js
@@
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
zsh: command not found: applypatch
Yousef@Apples-MacBook-Pro my-portfolio % cd ~/my-portfolio
git add package.json package-lock.json .eleventy.js _data/metadata.json
git commit -m "Upgrade Eleventy to v2 + enable RSS filters"
git push origin main
zsh: command not found: #
The following paths are ignored by one of your .gitignore files:
package-lock.json
Use -f if you really want to add them.
zsh: command not found: #
[main 55fc91a] Upgrade Eleventy to v2 + enable RSS filters
2 files changed, 3 insertions(+), 5 deletions(-)
zsh: command not found: #
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 405 bytes | 405.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
cbb1d8d..55fc91a main -> main
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version # لازم يطبع 2.x
npx @11ty/eleventy # يبني لـ _site بدون Errors
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
Yousef@Apples-MacBook-Pro my-portfolio % >....
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- run: touch _site/.nojekyll
- uses: actions/upload-pages-artifact@v3
with:
path: _site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
EOF
git add .github/workflows/deploy.yml
git commit -m "Add Eleventy deploy workflow"
git push origin main
Run npm run build
npm run build
shell: /usr/bin/bash -e {0}
[email protected] build
eleventy
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering njk template ./archive.njk (via TemplateContentRenderError)
[11ty] 2. (./archive.njk)
[11ty] Template render error: (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/_includes/postslist.njk)
[11ty] Error: filter not found: htmlDateString (via Template render error)
[11ty]
[11ty] Original error stack trace: Template render error: (./archive.njk)
[11ty] Template render error: (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/_includes/postslist.njk)
[11ty] Error: filter not found: htmlDateString
[11ty] at Object._prettifyError (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/lib.js:32:11)
[11ty] at /home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/environment.js:464:19
[11ty] at eval (eval at _compile (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:30:11)
[11ty] at /home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/environment.js:471:11
[11ty] at Template.root [as rootRenderFunc] (eval at _compile (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:105:3)
[11ty] at Template.render (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/environment.js:454:10)
[11ty] at eval (eval at _compile (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:29:10)
[11ty] at fn (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/a-sync-waterfall/index.js:26:24)
[11ty] at /home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/a-sync-waterfall/index.js:66:22
[11ty] at executeSync (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/a-sync-waterfall/index.js:8:15)
[11ty] Copied 6 files / Wrote 0 files in 0.24 seconds (v2.0.1)
Error: Process completed with exit code 1.
وده لينك المشروع
https://github.com/YousefMohamd/YousefMohamd.github.io
تمام يا يوسف — شفت اللوجز وكده واضح إن عندك مشكلتين رئيسيتين + شوية لخبطة أوامر:
npm ci
لأن مفيش package-lock.json
.filter not found: htmlDateString
، وده معناه إن فلتر RSS مش متسجّل (أو البلاجين مش متسطّب).كمان فيه سطور فيها تعليقات # ...
اتتلزق جوّه الأوامر، وEleventy اعتبرها arguments (عشان كده طلع لك: “We don’t know what ‘#’ is”).
خلّيني أديك خطوات قصيرة تحل كله مرّة واحدة:
محليًا في مشروعك:
bash# تحديث/تثبيت Eleventy 2 + RSS plugin npm i -E @11ty/eleventy@^2 @11ty/eleventy-plugin-rss@^2
افتح .eleventy.js
وتأكد إن فيه السطور دي:
js// .eleventy.js const pluginRss = require("@11ty/eleventy-plugin-rss"); module.exports = function (eleventyConfig) { eleventyConfig.addPlugin(pluginRss); // Fallback لو لأي سبب الفلتر مش متاح eleventyConfig.addFilter("htmlDateString", (dateObj) => { const d = new Date(dateObj); return d.toISOString().slice(0, 10); // YYYY-MM-DD مناسب لـ datetime }); };
ملاحظة: إضافة الفلاتر بالطريقة دي هي الموصى بيها في Eleventy، والـ RSS plugin هو اللي بيعرّف فلاتر التواريخ زي
htmlDateString
أصلًا. (Eleventy)
احفظ وعدّل commit:
bashgit add .eleventy.js package.json git commit -m "Install 11ty v2 + RSS plugin and add htmlDateString fallback"
npm ci
حاليًا .gitignore
عندك بيمنع package-lock.json
، وده سبب الخطأ في الـ CI.
.gitignore
واحذف أي سطر فيه package-lock.json
.bashnpm install # هيولّد package-lock.json git add .gitignore package-lock.json git commit -m "Include package-lock.json for CI" git push origin main
ليه ضروري؟ لأن
actions/setup-node
والـ caching بيتوقّعوا وجود lockfile في الروت. من غيره يطلع خطأ "Dependencies lock file is not found". (GitHub, chanwu.dev)
بديل (مش مفضّل): تغيّر خطوة الـ CI من
npm ci
لـnpm install
. بس الأفضل تسيبnpm ci
مع lockfile ثابت.
لما تشغّل:
bashnpx @11ty/eleventy --version npx @11ty/eleventy
ما تحطّش تعليقات عربي بعد الأمر في نفس السطر (زي # يبني لـ _site
) — ده اللي خلّى Eleventy يشتكي من #
.
وبرضه الأمر applypatch
مش أداة قياسية؛ إمّا تعدّل الملف بإيدك (الموصى بيه) أو تستخدم git apply
لو عندك باتش فعلي.
حدّث ملف .github/workflows/deploy.yml
بحيث يحتوي permissions وconcurrency الموصى بيهم لصفحات GitHub:
yamlname: Deploy Eleventy to GitHub Pages on: push: branches: [ "main" ] workflow_dispatch: permissions: contents: read pages: write id-token: write concurrency: group: "pages" cancel-in-progress: true jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: 'npm' - run: npm ci - run: npx @11ty/eleventy - run: touch _site/.nojekyll - uses: actions/upload-pages-artifact@v3 with: path: _site deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - id: deployment uses: actions/deploy-pages@v4
أذونات
pages: write
وid-token: write
مطلوبة علشان Action بتاع النشر يشتغل صح. (GitHub)
وبالمرة، في إعدادات الريبو → Pages خلّي المصدر GitHub Actions (لو مش معيّن بالفعل).
حدّث _data/metadata.json
بحيث:
json{ "title": "Yousef Mohamed", "url": "https://yousefmohamd.github.io" }
(من غير /
في الآخر)
bashnpx @11ty/eleventy --version # المفروض يطلع 2.x npx @11ty/eleventy # يبني فولدر _site من غير Errors
لو كل ده اتعمل:
filter not found: htmlDateString
هيختفي لأن البلاجين متسطّب والفولبّاك موجود.Dependencies lock file is not found
هيختفي لأنك أضفت package-lock.json
للريبو.لو عايزني أشيّك على محتوى .eleventy.js
الحالي أو deploy.yml
سطراً بسطر، ابعتهولي هنا وأنا أعدّلهولك فورًا.
ملاحظة: إضافة الفلاتر بالطريقة دي هي الموصى بيها في Eleventy، والـ RSS plugin هو اللي بيعرّف فلاتر التواريخ زي htmlDateString أصلًا. (Eleventy)
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPassthroughCopy({ "img": "img" });
eleventyConfig.addPassthroughCopy({ "css": "css" });
eleventyConfig.addPassthroughCopy({ "files": "files" });
return {
dir: { input: ".", includes: "_includes", data: "_data", output: "_site" },
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk",
templateFormats: ["njk","md","html"]
};
};
ده الي جواه
ده مافيهوش الي بتقول عليها هاته كله وخلاص
وده كل الي ظهر في الاوامر
Yousef@Apples-MacBook-Pro my-portfolio % git add -A
git commit -m "Fix CI: add RSS plugin, site URL, upgrade Eleventy, update config"
git push origin main
[main cbb1d8d] Fix CI: add RSS plugin, site URL, upgrade Eleventy, update config
2 files changed, 7 insertions(+), 3 deletions(-)
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 573 bytes | 573.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
46f9a99..cbb1d8d main -> main
Yousef@Apples-MacBook-Pro my-portfolio % cd ~/my-portfolio
npm install -D @11ty/eleventy@^2 @11ty/eleventy-plugin-rss@^1.2.0
zsh: parse error near `)'
Yousef@Apples-MacBook-Pro my-portfolio % cd ~/my-portfolio
npm pkg set "devDependencies.@11ty/eleventy"="^2.0.0"
npm pkg set "devDependencies.@11ty/eleventy-plugin-rss"="^1.2.0"
npm install
added 40 packages, removed 228 packages, changed 32 packages, and audited 230 packages in 13s
45 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % node -e "console.log('Eleventy:',require('./node_modules/@11ty/eleventy/package.json').version)"
Eleventy: 2.0.1
Yousef@Apples-MacBook-Pro my-portfolio % cat > .eleventy.js << 'EOF'
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPassthroughCopy({ "img": "img" });
eleventyConfig.addPassthroughCopy({ "css": "css" });
eleventyConfig.addPassthroughCopy({ "files": "files" });
return {
dir: { input: ".", includes: "_includes", data: "_data", output: "_site" },
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk",
templateFormats: ["njk","md","html"]
};
};
EOF
Yousef@Apples-MacBook-Pro my-portfolio % node -e "const fs=require('fs');const p='_data/metadata.json';let j=fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{author:{}};j.url=j.url||'https://yousefmohamd.github.io';fs.writeFileSync(p,JSON.stringify(j,null,2));console.log('metadata.url =',j.url)"
metadata.url = https://YousefMohamd.github.io
Yousef@Apples-MacBook-Pro my-portfolio % node -e "const fs=require('fs');const p='_data/metadata.json';let j=fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{author:{}};j.url=j.url||'https://yousefmohamd.github.io';fs.writeFileSync(p,JSON.stringify(j,null,2));console.log('metadata.url =',j.url)"
metadata.url = https://YousefMohamd.github.io
Yousef@Apples-MacBook-Pro my-portfolio % git commit -m "Upgrade Eleventy to v2 + enable RSS filters"
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
modified: .eleventy.js
modified: package.json
no changes added to commit
Yousef@Apples-MacBook-Pro my-portfolio % git push origin main
Everything up-to-date
Yousef@Apples-MacBook-Pro my-portfolio %
applypatch << 'EOF'
*** Begin Patch
*** Update File: .eleventy.js
@@
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
zsh: command not found: applypatch
Yousef@Apples-MacBook-Pro my-portfolio % applypatch << 'EOF'
*** Begin Patch
*** Update File: .eleventy.js
@@
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
zsh: command not found: applypatch
Yousef@Apples-MacBook-Pro my-portfolio % cd ~/my-portfolio
git add package.json package-lock.json .eleventy.js _data/metadata.json
git commit -m "Upgrade Eleventy to v2 + enable RSS filters"
git push origin main
zsh: command not found: #
The following paths are ignored by one of your .gitignore files:
package-lock.json
Use -f if you really want to add them.
zsh: command not found: #
[main 55fc91a] Upgrade Eleventy to v2 + enable RSS filters
2 files changed, 3 insertions(+), 5 deletions(-)
zsh: command not found: #
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 405 bytes | 405.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
cbb1d8d..55fc91a main -> main
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version # لازم يطبع 2.x
npx @11ty/eleventy # يبني لـ _site بدون Errors
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
Yousef@Apples-MacBook-Pro my-portfolio % >....
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- run: touch _site/.nojekyll
- uses: actions/upload-pages-artifact@v3
with:
path: _site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
EOF
git add .github/workflows/deploy.yml
git commit -m "Add Eleventy deploy workflow"
git push origin main
[main 1c0abbc] Add Eleventy deploy workflow
1 file changed, 10 insertions(+), 22 deletions(-)
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 536 bytes | 536.00 KiB/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
55fc91a..1c0abbc main -> main
Yousef@Apples-MacBook-Pro my-portfolio % # تحديث/تثبيت Eleventy 2 + RSS plugin
npm i -E @11ty/eleventy@^2 @11ty/eleventy-plugin-rss@^2
zsh: command not found: #
added 4 packages, changed 1 package, and audited 234 packages in 6s
46 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % nano eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % nano .eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % git add .eleventy.js package.json
git commit -m "Install 11ty v2 + RSS plugin and add htmlDateString fallback"
[main b24adc1] Install 11ty v2 + RSS plugin and add htmlDateString fallback
1 file changed, 2 insertions(+), 2 deletions(-)
Yousef@Apples-MacBook-Pro my-portfolio % npm install # هيولّد package-lock.json
git add .gitignore package-lock.json
git commit -m "Include package-lock.json for CI"
git push origin main
npm error code EINVALIDTAGNAME
npm error Invalid tag name "#" of package "#": Tags may not have any characters that encodeURIComponent encodes.
npm error A complete log of this run can be found in: /Users/Yousef/.npm/_logs/2025-08-26T22_00_13_458Z-debug-0.log
The following paths are ignored by one of your .gitignore files:
package-lock.json
Use -f if you really want to add them.
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 349 bytes | 349.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
1c0abbc..b24adc1 main -> main
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version
npx @11ty/eleventy
2.0.1
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] 1. Error processing the eleventyRssPlugin
plugin (via EleventyPluginError)
[11ty] 2. We found Eleventy version '2.0.1' which does not meet the required version range: '>=3.0.0-alpha.15'. Use npm install @11ty/eleventy
to upgrade your local project to the latest Eleventy version (or npm install @11ty/eleventy -g
to upgrade the globally installed version). (via UserConfigError)
[11ty]
[11ty] Original error stack trace: UserConfigError: We found Eleventy version '2.0.1' which does not meet the required version range: '>=3.0.0-alpha.15'. Use npm install @11ty/eleventy
to upgrade your local project to the latest Eleventy version (or npm install @11ty/eleventy -g
to upgrade the globally installed version).
[11ty] at UserConfig.versionCheck (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/UserConfig.js:115:13)
[11ty] at eleventyRssPlugin (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy-plugin-rss/src/rssPlugin.js:12:18)
[11ty] at UserConfig._executePlugin (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/UserConfig.js:386:7)
[11ty] at TemplateConfig.processPlugins (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:254:25)
[11ty] at TemplateConfig.mergeConfig (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:367:10)
[11ty] at TemplateConfig.getConfig (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:159:26)
[11ty] at new Eleventy (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/Eleventy.js:109:39)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:60:16)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
Yousef@Apples-MacBook-Pro my-portfolio % nano _data/metadata.json
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version # المفروض يطلع 2.x
npx @11ty/eleventy # يبني فولدر _site من غير Errors
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
Yousef@Apples-MacBook-Pro my-portfolio %
يوسف، تمام — واضح ليه لسه الـ CI/البيلد بيقع عندك. عندك حاجتين:
required version '>=3.0.0-alpha.15'
. الحل: ثبّت إصدار 1.2.0 من الـ RSS plugin المتوافق مع Eleventy v2. (GitHub)htmlDateString
ومش متعرّف عندك → هنضيفه بإيدنا كـ fallback.خلّيني أديك “نسخة لصق–ولعب” من الملف والأوامر من غير أي تعليقات (#) ولا باتشات applypatch.
شغّل دول واحد واحد في مشروعك:
v2 من الـ RSS plugin وما بعدها متوافقة مع Eleventy v3 فقط؛ عشان كده بنثبّت v1.2.0. (GitHub)
.eleventy.js
بالكاملانسخ ده زي ما هو:
js// .eleventy.js const pluginRss = require("@11ty/eleventy-plugin-rss"); module.exports = function(eleventyConfig) { // Plugins eleventyConfig.addPlugin(pluginRss); // Passthrough eleventyConfig.addPassthroughCopy({ "img": "img" }); eleventyConfig.addPassthroughCopy({ "css": "css" }); eleventyConfig.addPassthroughCopy({ "files": "files" }); // Fallback filters عشان القوالب اللي بتستعملها eleventyConfig.addFilter("htmlDateString", (dateObj) => { const d = new Date(dateObj); return d.toISOString().slice(0, 10); // YYYY-MM-DD للـ <time datetime=""> }); eleventyConfig.addFilter("readableDate", (dateObj) => { const d = new Date(dateObj); return d.toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" }); }); return { dir: { input: ".", includes: "_includes", data: "_data", output: "_site" }, htmlTemplateEngine: "njk", markdownTemplateEngine: "njk", templateFormats: ["njk","md","html"] }; };
(القالب الأساسي بتاع Eleventy بيستخدم فلترين تواريخ دول كتير، فعشان كده ضمنّالهم fallback آمن). (equk.co.uk)
package-lock.json
للريبوالمشكلة اللي ظهرت لك في Actions: Dependencies lock file is not found
لأن الـ lockfile متتضافش بسبب .gitignore
.
نفّذ بالترتيب:
bash# ولّد lockfile npm install # لو .gitignore بيطنّش lockfile شيله من الـ ignore أو اضغط إضافة بالقوة: git add -f package-lock.json git add .eleventy.js package.json git commit -m "Pin RSS plugin to v1.2.0 and add date filters; include lockfile" git push origin main
npm ci
في GitHub Actions محتاج lockfile موجود في جذور المشروع. (vitejs)
لو workflow عندك ناقص صلاحيات Pages، استخدم ده كما هو في .github/workflows/deploy.yml
:
yamlname: Deploy Eleventy to GitHub Pages on: push: branches: [ "main" ] # لو بتدفع على dev غيّرها لـ ["dev"] workflow_dispatch: permissions: contents: read pages: write id-token: write concurrency: group: "pages" cancel-in-progress: true jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: npm - run: npm ci - run: npx @11ty/eleventy - run: touch _site/.nojekyll - uses: actions/upload-pages-artifact@v3 with: path: _site deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - id: deployment uses: actions/deploy-pages@v4
الـ Action
deploy-pages
محتاجpages: write
وid-token: write
وإلا هيفشل النشر. (GitHub)
وفي إعدادات الريبو → Pages تأكد إن Source = GitHub Actions. (نموذج Vite موضح نفس الصلاحيات بالظبط). (vitejs)
شغّل:
bashnpx @11ty/eleventy --version npx @11ty/eleventy
لو كنت بتحب تكتب شرح عربي بعد الأوامر، اكتبه في سطر جديد؛ متكتبهوش بعد الأمر نفسه (عشان اللي حصل لك: Eleventy كان شايف #
كأنه Argument).
خلّي _data/metadata.json
فيه:
json{ "title": "Yousef Mohamed", "url": "https://yousefmohamd.github.io" }
(استخدم lowercase زي اللي فوق).
لو عملت الخطوات دي:
We found Eleventy version '2.0.1' ... >=3.0.0-alpha.15
هيختفي لأننا ثبّتنا RSS plugin المتوافق مع v2. (GitHub)filter not found: htmlDateString
هيروح لأن الفلتر بقى متعرّف.npm ci
في Actions هتشتغل بوجود package-lock.json
. (vitejs)لو حابب، ابعتلي دلوقتي محتوى package.json
وdeploy.yml
الحاليين وأنا أراجعهم سطر-بسطر.
نتايج تريمنال
Yousef@Apples-MacBook-Pro my-portfolio % node -e "let f='./package.json',p=require(f);p.scripts=p.scripts||{};p.scripts.build='eleventy';p.scripts.clean='rimraf _site || rm -rf _site';require('fs').writeFileSync(f,JSON.stringify(p,null,2))"
Yousef@Apples-MacBook-Pro my-portfolio % git add -A
git commit -m "Fix CI: add RSS plugin, site URL, upgrade Eleventy, update config"
git push origin main
[main cbb1d8d] Fix CI: add RSS plugin, site URL, upgrade Eleventy, update config
2 files changed, 7 insertions(+), 3 deletions(-)
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 573 bytes | 573.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
46f9a99..cbb1d8d main -> main
Yousef@Apples-MacBook-Pro my-portfolio % cd ~/my-portfolio
npm install -D @11ty/eleventy@^2 @11ty/eleventy-plugin-rss@^1.2.0
zsh: parse error near `)'
Yousef@Apples-MacBook-Pro my-portfolio % cd ~/my-portfolio
npm pkg set "devDependencies.@11ty/eleventy"="^2.0.0"
npm pkg set "devDependencies.@11ty/eleventy-plugin-rss"="^1.2.0"
npm install
added 40 packages, removed 228 packages, changed 32 packages, and audited 230 packages in 13s
45 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % node -e "console.log('Eleventy:',require('./node_modules/@11ty/eleventy/package.json').version)"
Eleventy: 2.0.1
Yousef@Apples-MacBook-Pro my-portfolio % cat > .eleventy.js << 'EOF'
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPassthroughCopy({ "img": "img" });
eleventyConfig.addPassthroughCopy({ "css": "css" });
eleventyConfig.addPassthroughCopy({ "files": "files" });
return {
dir: { input: ".", includes: "_includes", data: "_data", output: "_site" },
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk",
templateFormats: ["njk","md","html"]
};
};
EOF
Yousef@Apples-MacBook-Pro my-portfolio % node -e "const fs=require('fs');const p='_data/metadata.json';let j=fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{author:{}};j.url=j.url||'https://yousefmohamd.github.io';fs.writeFileSync(p,JSON.stringify(j,null,2));console.log('metadata.url =',j.url)"
metadata.url = https://YousefMohamd.github.io
Yousef@Apples-MacBook-Pro my-portfolio % node -e "const fs=require('fs');const p='_data/metadata.json';let j=fs.existsSync(p)?JSON.parse(fs.readFileSync(p)):{author:{}};j.url=j.url||'https://yousefmohamd.github.io';fs.writeFileSync(p,JSON.stringify(j,null,2));console.log('metadata.url =',j.url)"
metadata.url = https://YousefMohamd.github.io
Yousef@Apples-MacBook-Pro my-portfolio % git commit -m "Upgrade Eleventy to v2 + enable RSS filters"
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
modified: .eleventy.js
modified: package.json
no changes added to commit
Yousef@Apples-MacBook-Pro my-portfolio % git push origin main
Everything up-to-date
Yousef@Apples-MacBook-Pro my-portfolio %
applypatch << 'EOF'
*** Begin Patch
*** Update File: .eleventy.js
@@
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
zsh: command not found: applypatch
Yousef@Apples-MacBook-Pro my-portfolio % applypatch << 'EOF'
*** Begin Patch
*** Update File: .eleventy.js
@@
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
zsh: command not found: applypatch
Yousef@Apples-MacBook-Pro my-portfolio % cd ~/my-portfolio
git add package.json package-lock.json .eleventy.js _data/metadata.json
git commit -m "Upgrade Eleventy to v2 + enable RSS filters"
git push origin main
zsh: command not found: #
The following paths are ignored by one of your .gitignore files:
package-lock.json
Use -f if you really want to add them.
zsh: command not found: #
[main 55fc91a] Upgrade Eleventy to v2 + enable RSS filters
2 files changed, 3 insertions(+), 5 deletions(-)
zsh: command not found: #
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 405 bytes | 405.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
cbb1d8d..55fc91a main -> main
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version # لازم يطبع 2.x
npx @11ty/eleventy # يبني لـ _site بدون Errors
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
Yousef@Apples-MacBook-Pro my-portfolio % >....
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- run: touch _site/.nojekyll
- uses: actions/upload-pages-artifact@v3
with:
path: _site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
EOF
git add .github/workflows/deploy.yml
git commit -m "Add Eleventy deploy workflow"
git push origin main
[main 1c0abbc] Add Eleventy deploy workflow
1 file changed, 10 insertions(+), 22 deletions(-)
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 536 bytes | 536.00 KiB/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
55fc91a..1c0abbc main -> main
Yousef@Apples-MacBook-Pro my-portfolio % # تحديث/تثبيت Eleventy 2 + RSS plugin
npm i -E @11ty/eleventy@^2 @11ty/eleventy-plugin-rss@^2
zsh: command not found: #
added 4 packages, changed 1 package, and audited 234 packages in 6s
46 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % nano eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % nano .eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % git add .eleventy.js package.json
git commit -m "Install 11ty v2 + RSS plugin and add htmlDateString fallback"
[main b24adc1] Install 11ty v2 + RSS plugin and add htmlDateString fallback
1 file changed, 2 insertions(+), 2 deletions(-)
Yousef@Apples-MacBook-Pro my-portfolio % npm install # هيولّد package-lock.json
git add .gitignore package-lock.json
git commit -m "Include package-lock.json for CI"
git push origin main
npm error code EINVALIDTAGNAME
npm error Invalid tag name "#" of package "#": Tags may not have any characters that encodeURIComponent encodes.
npm error A complete log of this run can be found in: /Users/Yousef/.npm/_logs/2025-08-26T22_00_13_458Z-debug-0.log
The following paths are ignored by one of your .gitignore files:
package-lock.json
Use -f if you really want to add them.
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 349 bytes | 349.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
1c0abbc..b24adc1 main -> main
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version
npx @11ty/eleventy
2.0.1
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] 1. Error processing the eleventyRssPlugin
plugin (via EleventyPluginError)
[11ty] 2. We found Eleventy version '2.0.1' which does not meet the required version range: '>=3.0.0-alpha.15'. Use npm install @11ty/eleventy
to upgrade your local project to the latest Eleventy version (or npm install @11ty/eleventy -g
to upgrade the globally installed version). (via UserConfigError)
[11ty]
[11ty] Original error stack trace: UserConfigError: We found Eleventy version '2.0.1' which does not meet the required version range: '>=3.0.0-alpha.15'. Use npm install @11ty/eleventy
to upgrade your local project to the latest Eleventy version (or npm install @11ty/eleventy -g
to upgrade the globally installed version).
[11ty] at UserConfig.versionCheck (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/UserConfig.js:115:13)
[11ty] at eleventyRssPlugin (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy-plugin-rss/src/rssPlugin.js:12:18)
[11ty] at UserConfig._executePlugin (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/UserConfig.js:386:7)
[11ty] at TemplateConfig.processPlugins (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:254:25)
[11ty] at TemplateConfig.mergeConfig (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:367:10)
[11ty] at TemplateConfig.getConfig (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:159:26)
[11ty] at new Eleventy (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/Eleventy.js:109:39)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:60:16)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
Yousef@Apples-MacBook-Pro my-portfolio % nano _data/metadata.json
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version # المفروض يطلع 2.x
npx @11ty/eleventy # يبني فولدر _site من غير Errors
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
Yousef@Apples-MacBook-Pro my-portfolio % nano .eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % npm remove @11ty/eleventy-plugin-rss
npm i -D @11ty/eleventy@^2 @11ty/[email protected]
removed 5 packages, and audited 229 packages in 2s
44 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
added 1 package, and audited 230 packages in 2s
45 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % nano .eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % npm install
up to date, audited 230 packages in 1s
45 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % git add -f package-lock.json
Yousef@Apples-MacBook-Pro my-portfolio % git add .eleventy.js package.json
Yousef@Apples-MacBook-Pro my-portfolio % git commit -m "Pin RSS plugin to v1.2.0 and add date filters; include lockfile"
[main 2bd507f] Pin RSS plugin to v1.2.0 and add date filters; include lockfile
3 files changed, 2814 insertions(+), 2 deletions(-)
create mode 100644 package-lock.json
Yousef@Apples-MacBook-Pro my-portfolio % git push origin main
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 26.05 KiB | 8.68 MiB/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
b24adc1..2bd507f main -> main
Yousef@Apples-MacBook-Pro my-portfolio % nano .github/workflows/deploy.yml
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version
npx @11ty/eleventy
2.0.1
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering njk template ./archive.njk (via TemplateContentRenderError)
[11ty] 2. (./archive.njk)
[11ty] Template render error: (/Users/Yousef/my-portfolio/_includes/postslist.njk) [Line 6, Column 40]
[11ty] Error: Unable to call collections["tagList"]["indexOf"]
, which is undefined or falsey (via Template render error)
[11ty]
[11ty] Original error stack trace: Template render error: (./archive.njk)
[11ty] Template render error: (/Users/Yousef/my-portfolio/_includes/postslist.njk) [Line 6, Column 40]
[11ty] Error: Unable to call collections["tagList"]["indexOf"]
, which is undefined or falsey
[11ty] at Object._prettifyError (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/lib.js:32:11)
[11ty] at /Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:464:19
[11ty] at eval (eval at _compile (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:30:11)
[11ty] at /Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:471:11
[11ty] at Template.root [as rootRenderFunc] (eval at _compile (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:105:3)
[11ty] at Template.render (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:454:10)
[11ty] at eval (eval at _compile (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:29:10)
[11ty] at fn (/Users/Yousef/my-portfolio/node_modules/a-sync-waterfall/index.js:26:24)
[11ty] at /Users/Yousef/my-portfolio/node_modules/a-sync-waterfall/index.js:66:22
[11ty] at executeSync (/Users/Yousef/my-portfolio/node_modules/a-sync-waterfall/index.js:8:15)
[11ty] Copied 4 files / Wrote 0 files in 0.47 seconds (v2.0.1)
Yousef@Apples-MacBook-Pro my-portfolio %
نتايج المستنقع ولاخطاء
Run npm run build
[email protected] build
eleventy
collections["tagList"]["indexOf"]
, which is undefined or falsey (via Template render error)collections["tagList"]["indexOf"]
, which is undefined or falseyRun actions/setup-node@v4
Found in cache @ /opt/hostedtoolcache/node/20.19.4/x64
Environment details
/opt/hostedtoolcache/node/20.19.4/x64/bin/npm config get cache
/home/runner/.npm
Error: Dependencies lock file is not found in /home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io. Supported file patterns: package-lock.json,npm-shrinkwrap.json,yarn.lock
حلو جدًا يا يوسف 👏 واضح إنك خلّصت أهم جزءين:
دلوقتي الخطأ الجديد:
Unable to call collections["tagList"]["indexOf"], which is undefined
ده لأن القالب بتاعك بيستخدم collections.tagList
(وكمان filterTagList
) لكن إحنا لسه ماعرّفناش الـ collection/الفلاتر دي في .eleventy.js
. ده طبيعي في تمبلت Eleventy Base Blog—لازم تضيف الـ collection اللي بتجمع كل التاجز وتستبعد all/nav/post/posts
. توثيق Eleventy بيشرح موضوع الـ Collections، وتمبلت الـ Base Blog بيستخدم htmlDateString
وreadableDate
في postslist.njk
، فإحنا هنكمّل النواقص دول في config. (Eleventy, GitHub)
كمان تذكير سريع: نسخة RSS plugin v2 بتحتاج Eleventy v3 فما تنزلهاش دلوقتي (إنت فعلًا رجّعتها لـ 1.2.0 المتوافقة مع Eleventy v2). (githubissues.com, npm)
.eleventy.js
بالكاملانسخ/الزق الملف ده (هيضيف الـ plugin + الفلاتر + مجموعة التاجز):
js// .eleventy.js const pluginRss = require("@11ty/eleventy-plugin-rss"); module.exports = function(eleventyConfig) { // Plugins eleventyConfig.addPlugin(pluginRss); // Static passthrough eleventyConfig.addPassthroughCopy({ "img": "img" }); eleventyConfig.addPassthroughCopy({ "css": "css" }); eleventyConfig.addPassthroughCopy({ "files": "files" }); // ---- Dates (fallbacks للـ قوالب) ---- eleventyConfig.addFilter("htmlDateString", (dateObj) => { const d = new Date(dateObj); return d.toISOString().slice(0, 10); // YYYY-MM-DD لـ <time datetime=""> }); eleventyConfig.addFilter("readableDate", (dateObj) => { const d = new Date(dateObj); return d.toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" }); }); // ---- Tags utilities (زي تمبلت Eleventy Base Blog) ---- const EXCLUDED = new Set(["all", "nav", "post", "posts"]); eleventyConfig.addFilter("filterTagList", (tags) => (tags || []).filter((t) => !EXCLUDED.has(t)) ); eleventyConfig.addCollection("tagList", (collectionApi) => { const tagSet = new Set(); collectionApi.getAll().forEach((item) => { (item.data.tags || []).forEach((tag) => { if (!EXCLUDED.has(tag)) tagSet.add(tag); }); }); return Array.from(tagSet).sort(); }); return { dir: { input: ".", includes: "_includes", data: "_data", output: "_site" }, htmlTemplateEngine: "njk", markdownTemplateEngine: "njk", templateFormats: ["njk","md","html"] }; };
ده بيكمّل الـ collections والفلترز اللي القوالب مستنيّاها (راجع وثائق Eleventy عن Collections، و
postslist.njk
في الـ Base Blog اللي بيعتمد على فلاتر التاريخ). (Eleventy, GitHub)
إنت بالفعل عملتها، لكن للتأكيد:
إصدارات v2.x من plugin الـ RSS عايزة Eleventy v3 (
>= 3.0.0-alpha.15
)؛ عشان كده بنثبت 1.2.0. (githubissues.com)
#
في نفس السطر)bashnpx @11ty/eleventy --version npx @11ty/eleventy
bashgit add .eleventy.js package.json git commit -m "Add tagList/filterTagList + date filters; finalize Eleventy v2 setup" git push origin main
الـ Run اللي كان بيقول Dependencies lock file is not found
غالبًا كان من قبل ما تدفع package-lock.json
. بعد الكومِت 2bd507f
اللي أضافه، المفروض المشكلة تختفي في الرنّات الجديدة. لو مازال ظاهر:
package-lock.json
موجود في جذر الريبو (نفس المسار اللي ظاهر في اللوج).npm ci
(يحتاج lockfile)، ومتنساش إننا بالفعل ضفناه..gitignore
قبل كده، خلاص إحنا ضفناه بـ git add -f
فبقى ضمن التاريخ.postslist.njk
لو—بعد التعديلات—لسه ظهر نفس الخطأ، يبقى ملف _includes/postslist.njk
نفسه فيه سطر بيعمل collections["tagList"].indexOf(...)
مباشرة. تقدر تأمّنه بسرعة كده:
بدّل أي استعمال مباشر لـ collections.tagList
بـ:
njk{{ (collections.tagList | default([])) }}
بس غالبًا مش هتحتاج ده بعد ما ضفنا الـ addCollection("tagList")
.
جرّب كده وابنِ محليًا. لو البيلد اشتغل عندك بدون Errors، الـ GitHub Actions هيكمّل طبيعي ويبعت على Pages.
لو حابب تبعتلي محتوى archive.njk
و_includes/postslist.njk
هعدّلهملك فورًا لو فيهم سطر محتاج تأمين.
النتايج
Yousef@Apples-MacBook-Pro my-portfolio % # تحديث/تثبيت Eleventy 2 + RSS plugin
npm i -E @11ty/eleventy@^2 @11ty/eleventy-plugin-rss@^2
zsh: command not found: #
added 4 packages, changed 1 package, and audited 234 packages in 6s
46 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % nano eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % nano .eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % git add .eleventy.js package.json
git commit -m "Install 11ty v2 + RSS plugin and add htmlDateString fallback"
[main b24adc1] Install 11ty v2 + RSS plugin and add htmlDateString fallback
1 file changed, 2 insertions(+), 2 deletions(-)
Yousef@Apples-MacBook-Pro my-portfolio % npm install # هيولّد package-lock.json
git add .gitignore package-lock.json
git commit -m "Include package-lock.json for CI"
git push origin main
npm error code EINVALIDTAGNAME
npm error Invalid tag name "#" of package "#": Tags may not have any characters that encodeURIComponent encodes.
npm error A complete log of this run can be found in: /Users/Yousef/.npm/_logs/2025-08-26T22_00_13_458Z-debug-0.log
The following paths are ignored by one of your .gitignore files:
package-lock.json
Use -f if you really want to add them.
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 349 bytes | 349.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
1c0abbc..b24adc1 main -> main
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version
npx @11ty/eleventy
2.0.1
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] 1. Error processing the eleventyRssPlugin
plugin (via EleventyPluginError)
[11ty] 2. We found Eleventy version '2.0.1' which does not meet the required version range: '>=3.0.0-alpha.15'. Use npm install @11ty/eleventy
to upgrade your local project to the latest Eleventy version (or npm install @11ty/eleventy -g
to upgrade the globally installed version). (via UserConfigError)
[11ty]
[11ty] Original error stack trace: UserConfigError: We found Eleventy version '2.0.1' which does not meet the required version range: '>=3.0.0-alpha.15'. Use npm install @11ty/eleventy
to upgrade your local project to the latest Eleventy version (or npm install @11ty/eleventy -g
to upgrade the globally installed version).
[11ty] at UserConfig.versionCheck (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/UserConfig.js:115:13)
[11ty] at eleventyRssPlugin (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy-plugin-rss/src/rssPlugin.js:12:18)
[11ty] at UserConfig._executePlugin (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/UserConfig.js:386:7)
[11ty] at TemplateConfig.processPlugins (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:254:25)
[11ty] at TemplateConfig.mergeConfig (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:367:10)
[11ty] at TemplateConfig.getConfig (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateConfig.js:159:26)
[11ty] at new Eleventy (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/Eleventy.js:109:39)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:60:16)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
Yousef@Apples-MacBook-Pro my-portfolio % nano _data/metadata.json
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version # المفروض يطلع 2.x
npx @11ty/eleventy # يبني فولدر _site من غير Errors
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
[11ty] Eleventy CLI Fatal Error: (more in DEBUG output)
[11ty] We don’t know what '#' is. Use --help to see the list of supported commands. (via EleventyCommandCheckError)
[11ty]
[11ty] Original error stack trace: EleventyCommandCheckError: We don’t know what '#' is. Use --help to see the list of supported commands.
[11ty] at Object.unknown [as unknownFn] (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:36:13)
[11ty] at module.exports (/Users/Yousef/my-portfolio/node_modules/minimist/index.js:234:34)
[11ty] at Object.<anonymous> (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/cmd.js:19:35)
[11ty] at Module._compile (node:internal/modules/cjs/loader:1688:14)
[11ty] at Object..js (node:internal/modules/cjs/loader:1820:10)
[11ty] at Module.load (node:internal/modules/cjs/loader:1423:32)
[11ty] at Function._load (node:internal/modules/cjs/loader:1246:12)
[11ty] at TracingChannel.traceSync (node:diagnostics_channel:322:14)
[11ty] at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
[11ty] at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
Yousef@Apples-MacBook-Pro my-portfolio % nano .eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % npm remove @11ty/eleventy-plugin-rss
npm i -D @11ty/eleventy@^2 @11ty/[email protected]
removed 5 packages, and audited 229 packages in 2s
44 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
added 1 package, and audited 230 packages in 2s
45 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % nano .eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % npm install
up to date, audited 230 packages in 1s
45 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % git add -f package-lock.json
Yousef@Apples-MacBook-Pro my-portfolio % git add .eleventy.js package.json
Yousef@Apples-MacBook-Pro my-portfolio % git commit -m "Pin RSS plugin to v1.2.0 and add date filters; include lockfile"
[main 2bd507f] Pin RSS plugin to v1.2.0 and add date filters; include lockfile
3 files changed, 2814 insertions(+), 2 deletions(-)
create mode 100644 package-lock.json
Yousef@Apples-MacBook-Pro my-portfolio % git push origin main
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 26.05 KiB | 8.68 MiB/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
b24adc1..2bd507f main -> main
Yousef@Apples-MacBook-Pro my-portfolio % nano .github/workflows/deploy.yml
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version
npx @11ty/eleventy
2.0.1
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering njk template ./archive.njk (via TemplateContentRenderError)
[11ty] 2. (./archive.njk)
[11ty] Template render error: (/Users/Yousef/my-portfolio/_includes/postslist.njk) [Line 6, Column 40]
[11ty] Error: Unable to call collections["tagList"]["indexOf"]
, which is undefined or falsey (via Template render error)
[11ty]
[11ty] Original error stack trace: Template render error: (./archive.njk)
[11ty] Template render error: (/Users/Yousef/my-portfolio/_includes/postslist.njk) [Line 6, Column 40]
[11ty] Error: Unable to call collections["tagList"]["indexOf"]
, which is undefined or falsey
[11ty] at Object._prettifyError (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/lib.js:32:11)
[11ty] at /Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:464:19
[11ty] at eval (eval at _compile (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:30:11)
[11ty] at /Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:471:11
[11ty] at Template.root [as rootRenderFunc] (eval at _compile (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:105:3)
[11ty] at Template.render (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:454:10)
[11ty] at eval (eval at _compile (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:29:10)
[11ty] at fn (/Users/Yousef/my-portfolio/node_modules/a-sync-waterfall/index.js:26:24)
[11ty] at /Users/Yousef/my-portfolio/node_modules/a-sync-waterfall/index.js:66:22
[11ty] at executeSync (/Users/Yousef/my-portfolio/node_modules/a-sync-waterfall/index.js:8:15)
[11ty] Copied 4 files / Wrote 0 files in 0.47 seconds (v2.0.1)
Yousef@Apples-MacBook-Pro my-portfolio % nano .eleventy.js
Yousef@Apples-MacBook-Pro my-portfolio % npm remove @11ty/eleventy-plugin-rss
removed 1 package, and audited 229 packages in 5s
44 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % npm i -D @11ty/eleventy@^2 @11ty/[email protected]
added 1 package, and audited 230 packages in 3s
45 packages are looking for funding
run npm fund
for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version
npx @11ty/eleventy
2.0.1
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering njk template ./404.md (via TemplateContentRenderError)
[11ty] 2. (./404.md) [Line 5, Column 4]
[11ty] unknown block tag: comment (via Template render error)
[11ty]
[11ty] Original error stack trace: Template render error: (./404.md) [Line 5, Column 4]
[11ty] unknown block tag: comment
[11ty] at Object._prettifyError (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/lib.js:32:11)
[11ty] at Template.init (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:416:19)
[11ty] at Template.Obj (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/object.js:51:15)
[11ty] at new Template (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:390:18)
[11ty] at Nunjucks.compile (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:406:14)
[11ty] at Markdown.compile (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/Engines/Markdown.js:68:28)
[11ty] at TemplateRender.getCompiledTemplate (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateRender.js:269:26)
[11ty] at Template.compile (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateContent.js:362:42)
[11ty] at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
[11ty] at async Template._render (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateContent.js:486:16)
[11ty] Benchmark 64ms 12% 12× (Configuration) "readableDate" Nunjucks Filter
[11ty] Copied 4 files / Wrote 0 files in 0.49 seconds (v2.0.1)
Yousef@Apples-MacBook-Pro my-portfolio % git add .eleventy.js package.json
git commit -m "Add tagList/filterTagList + date filters; finalize Eleventy v2 setup"
git push origin main
[main 467a8f4] Add tagList/filterTagList + date filters; finalize Eleventy v2 setup
1 file changed, 18 insertions(+), 3 deletions(-)
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 693 bytes | 693.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
2bd507f..467a8f4 main -> main
Yousef@Apples-MacBook-Pro my-portfolio %
ونفس الاخطاء علي المتنقع في الاكشن ورك فلو مش بيبلد
برافو يا يوسف 👏 شغلك وصل لحد كبير. دلوقتي اللي باين من اللوجز إننا اتحركنا خطوة لقدّام:
{% comment %}
في 404.md
→ لازم تتكتب تعليقات ننجكس بالطريقة {# ... #}
. (Mozilla GitHub Pages, docs.mydukaan.io)package-lock.json
. آخر رنات بعد الكومِت اللي ضافه لازم تعدّي خطوة npm ci
.خلّيه “نسخ–لزق” علشان نقفلها:
{% comment %}
في المشروع كله(على macOS؛ الأوامر من غير أي تعليقات في آخر السطر)
bash# استبدال كل فتحات comment grep -rl "{% *comment *%}" -- . | xargs sed -i '' -e 's/{% *comment *%}/{# /g' # استبدال كل إغلاقات endcomment grep -rl "{% *endcomment *%}" -- . | xargs sed -i '' -e 's/{% *endcomment *%}/ #}/g'
لو حابب تستهدف الملف اللي ظهر في اللوج بس:
bashsed -i '' -e 's/{% *comment *%}/{# /g' -e 's/{% *endcomment *%}/ #}/g' 404.md
ننجكس مابيعرّفش بلوك باسم
comment
؛ الصيغة الصحيحة للتعليق هي{# ... #}
. (Mozilla GitHub Pages)
.eleventy.js
بما إنك ضفت الـ filters والـ collections، خليه كده (لو مش عاملها بالفعل):
jsconst pluginRss = require("@11ty/eleventy-plugin-rss"); module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPassthroughCopy({ "img": "img" }); eleventyConfig.addPassthroughCopy({ "css": "css" }); eleventyConfig.addPassthroughCopy({ "files": "files" }); // فلاتر تواريخ eleventyConfig.addFilter("htmlDateString", d => new Date(d).toISOString().slice(0,10)); eleventyConfig.addFilter("readableDate", d => new Date(d).toLocaleDateString("en-US", {year:"numeric", month:"long", day:"numeric"}) ); // tags utilities زي الـ Base Blog const EXCLUDED = new Set(["all","nav","post","posts"]); eleventyConfig.addFilter("filterTagList", tags => (tags || []).filter(t => !EXCLUDED.has(t))); eleventyConfig.addCollection("tagList", api => { const set = new Set(); api.getAll().forEach(item => (item.data.tags || []).forEach(t => !EXCLUDED.has(t) && set.add(t))); return Array.from(set).sort(); }); return { dir: { input: ".", includes: "_includes", data: "_data", output: "_site" }, htmlTemplateEngine: "njk", markdownTemplateEngine: "njk", templateFormats: ["njk","md","html"] }; };
#
في نفس السطر)bashnpx @11ty/eleventy --version npx @11ty/eleventy
لو البنّاء عدى محليًا، كمل:
bashgit add -A git commit -m "Replace {% comment %} blocks with Nunjucks comments and finalize Eleventy v2 setup" git push origin main
npm ci
مع وجود package-lock.json
في جذر الريبو. لو كانت رسالة “lock file is not found” ظهرت في رنّ قديم، راجع آخر رنّ للكومِت اللي فيه package-lock.json
— المفروض الخطوة تعدّي دلوقتي.npm ci
+ npm run build
، والـ workflow فيه:
permissions: { contents: read, pages: write, id-token: write }
actions/upload-pages-artifact@v3
بـ path: _site
actions/deploy-pages@v4
@11ty/eleventy-plugin-rss@^2
عايز Eleventy v3؛ وإنت على v2، فـ نثبّت v1.2.0 من الـ plugin. كده البروجكت يكمّل طبيعي. (11ty.dev, GitHub){# ... #}
مش بلوك {% comment %}
، وإلا هتشوف unknown block tag: comment
. (Mozilla GitHub Pages)جرّب الخطوات دي دلوقتي. لو بعد الاستبدال لسه في Error، ابعتلي سطر 4–8 من 404.md
و/أو محتوى _includes/postslist.njk
وأنا هصلّحهالك فورًا هنا.
الي ظهر علي تريمنال
Yousef@Apples-MacBook-Pro my-portfolio % grep -rl "{% *comment *%}" -- . | xargs sed -i '' -e 's/{% *comment *%}/{# /g'
Yousef@Apples-MacBook-Pro my-portfolio % grep -rl "{% *endcomment *%}" -- . | xargs sed -i '' -e 's/{% *endcomment *%}/ #}/g'
Yousef@Apples-MacBook-Pro my-portfolio % npx @11ty/eleventy --version
npx @11ty/eleventy
2.0.1
[11ty] Writing _site/sitemap.xml from ./sitemap.xml.njk
[11ty] Writing _site/feed/.htaccess from ./feed/htaccess.njk
[11ty] Writing _site/feed/feed.xml from ./feed/feed.njk
[11ty] Writing _site/projects/concept-dystopian-city/index.html from ./projects/concept-dystopian-city.md (njk)
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble writing to "_site/about/index.html" from "./about/index.md" (via EleventyTemplateError)
[11ty] 2. (./_includes/layouts/base.njk)
[11ty] Error: filter not found: eleventyNavigation (via Template render error)
[11ty]
[11ty] Original error stack trace: Template render error: (./_includes/layouts/base.njk)
[11ty] Error: filter not found: eleventyNavigation
[11ty] at Object._prettifyError (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/lib.js:32:11)
[11ty] at /Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:464:19
[11ty] at Template.root [as rootRenderFunc] (eval at _compile (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:65:3)
[11ty] at Template.render (/Users/Yousef/my-portfolio/node_modules/nunjucks/src/environment.js:454:10)
[11ty] at /Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:411:14
[11ty] at new Promise (<anonymous>)
[11ty] at /Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:410:14
[11ty] at TemplateLayout.render (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/TemplateLayout.js:236:31)
[11ty] at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
[11ty] at async Template.renderPageEntry (/Users/Yousef/my-portfolio/node_modules/@11ty/eleventy/src/Template.js:793:17)
[11ty] Benchmark 74ms 11% 69× (Configuration) "readableDate" Nunjucks Filter
[11ty] Copied 4 files / Wrote 0 files in 0.65 seconds (v2.0.1)
Yousef@Apples-MacBook-Pro my-portfolio % git add -A
git commit -m "Replace {% comment %} blocks with Nunjucks comments and finalize Eleventy v2 setup"
git push origin main
[main dac20bb] Replace {% comment %} blocks with Nunjucks comments and finalize Eleventy v2 setup
24 files changed, 6 insertions(+), 5 deletions(-)
rename img/projects/concept-art/{concept21.jpg => 1.jpg} (100%)
rename img/projects/concept-art/{concept12.png => 10.png} (100%)
rename img/projects/concept-art/{concept11.jpg => 11.jpg} (100%)
rename img/projects/concept-art/{concept10.jpg => 12.jpg} (100%)
rename img/projects/concept-art/{concept09.jpg => 13.jpg} (100%)
rename img/projects/concept-art/{concept08.jpg => 14.jpg} (100%)
rename img/projects/concept-art/{concept07.jpg => 15.jpg} (100%)
rename img/projects/concept-art/{concept06.png => 16.png} (100%)
rename img/projects/concept-art/{concept05.png => 17.png} (100%)
rename img/projects/concept-art/{concept04.png => 18.png} (100%)
rename img/projects/concept-art/{concept03.png => 19.png} (100%)
rename img/projects/concept-art/{concept20.jpg => 2.jpg} (100%)
rename img/projects/concept-art/{concept02.png => 20.png} (100%)
rename img/projects/concept-art/{concept01.png => 21.png} (100%)
rename img/projects/concept-art/{concept00.png => 22.png} (100%)
rename img/projects/concept-art/{concept19.png => 3.png} (100%)
rename img/projects/concept-art/{concept18.jpg => 4.jpg} (100%)
rename img/projects/concept-art/{concept17.jpg => 5.jpg} (100%)
rename img/projects/concept-art/{concept16.png => 6.png} (100%)
rename img/projects/concept-art/{concept15.JPEG => 7.JPEG} (100%)
rename img/projects/concept-art/{concept14.jpg => 8.jpg} (100%)
rename img/projects/concept-art/{concept13.jpeg => 9.jpeg} (100%)
Counting objects: 9, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 1.12 KiB | 1.12 MiB/s, done.
Total 9 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To https://github.com/YousefMohamd/YousefMohamd.github.io.git
467a8f4..dac20bb main -> main
Yousef@Apples-MacBook-Pro my-portfolio %
الايروز علي جت هب
Run npm run build
[email protected] build
eleventy
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering njk template ./404.md (via TemplateContentRenderError)
[11ty] 2. (./404.md) [Line 5, Column 4]
[11ty] unknown block tag: comment (via Template render error)
[11ty]
[11ty] Original error stack trace: Template render error: (./404.md) [Line 5, Column 4]
[11ty] unknown block tag: comment
[11ty] at Object._prettifyError (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/lib.js:32:11)
[11ty] at Template.init (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/environment.js:416:19)
[11ty] at Template.Obj (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/object.js:51:15)
[11ty] at new Template (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/nunjucks/src/environment.js:390:18)
[11ty] at Nunjucks.compile (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:406:14)
[11ty] at Markdown.compile (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/@11ty/eleventy/src/Engines/Markdown.js:68:28)
[11ty] at TemplateRender.getCompiledTemplate (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/@11ty/eleventy/src/TemplateRender.js:269:26)
[11ty] at Template.compile (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/@11ty/eleventy/src/TemplateContent.js:362:42)
[11ty] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[11ty] at async Template._render (/home/runner/work/YousefMohamd.github.io/YousefMohamd.github.io/node_modules/@11ty/eleventy/src/TemplateContent.js:486:16)
[11ty] Benchmark 271ms 50% 12× (Configuration) "readableDate" Nunjucks Filter
[11ty] Copied 6 files / Wrote 0 files in 0.53 seconds (v2.0.1)
Error: Process completed with exit code 1.
جامد جدًا يا يوسف — البيلد اتحرك وكتب شوية ملفات قبل ما يوقف 👌
دلوقتي عندك مشكلتين بس (واضحين من اللوج):
unknown block tag: comment
في 404.md
→ لسه فيه {% comment %}
/{% endcomment %}
جوّا الملف.filter not found: eleventyNavigation
→ محتاج تضيف Plugin التنقّل بتاع Eleventy.هنقفل الاتنين دول دلوقتي خطوة-بخطوة (أوامر نظيفة من غير #
في آخر السطر):
{% comment %}
نهائيًاأحيانًا الوسوم بتكون فيها شرطات -
أو مسافات مختلفة، فخلّينا نستبدل كل الأشكال المحتملة على مستوى الريبو:
bash# بدّل كل أشكال فتح/قفل comment (بما فيها {%- comment -%}) grep -rl "\{%-\{0,1\} *comment *-\{0,1\}%\}" -- . | xargs sed -E -i '' 's/\{%-?\s*comment\s*-?%\}/{# /g' grep -rl "\{%-\{0,1\} *endcomment *-\{0,1\}%\}" -- . | xargs sed -E -i '' 's/\{%-?\s*endcomment\s*-?%\}/ #}/g'
ولو حابب تستهدف الملف اللي ظهر في الخطأ مباشرة:
bashsed -E -i '' \ -e 's/\{%-?\s*comment\s*-?%\}/{# /g' \ -e 's/\{%-?\s*endcomment\s*-?%\}/ #}/g' \ 404.md
نونجاكس بيدعم التعليق بالشكل
{# ... #}
فقط. أي{% comment %}
(ستايل Liquid/Jekyll) بتكسره.
القالب بتاعك بيستخدم الفلتر eleventyNavigation
جوّا base.njk
. ده جاي من Plugin رسمي.
bashnpm i -D @11ty/eleventy-navigation
.eleventy.js
استبدل محتوى الملف بالكامل بالنص ده (بيشمل RSS + Navigation + فلاتر التاريخ + tags utilities):
js// .eleventy.js const pluginRss = require("@11ty/eleventy-plugin-rss"); const pluginNavigation = require("@11ty/eleventy-navigation"); module.exports = function(eleventyConfig) { // Plugins eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginNavigation); // Static passthrough eleventyConfig.addPassthroughCopy({ "img": "img" }); eleventyConfig.addPassthroughCopy({ "css": "css" }); eleventyConfig.addPassthroughCopy({ "files": "files" }); // Date filters (fallbacks) eleventyConfig.addFilter("htmlDateString", (d) => new Date(d).toISOString().slice(0, 10)); eleventyConfig.addFilter("readableDate", (d) => new Date(d).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" }) ); // Tags utilities (زي Eleventy Base Blog) const EXCLUDED = new Set(["all","nav","post","posts"]); eleventyConfig.addFilter("filterTagList", (tags) => (tags || []).filter((t) => !EXCLUDED.has(t))); eleventyConfig.addCollection("tagList", (api) => { const set = new Set(); api.getAll().forEach((item) => { (item.data.tags || []).forEach((t) => { if(!EXCLUDED.has(t)) set.add(t); }); }); return Array.from(set).sort(); }); return { dir: { input: ".", includes: "_includes", data: "_data", output: "_site" }, htmlTemplateEngine: "njk", markdownTemplateEngine: "njk", templateFormats: ["njk","md","html"] }; };
bashnpx @11ty/eleventy --version npx @11ty/eleventy
لو عدى بدون Errors، كمّل:
bashgit add -A git commit -m "Fix Nunjucks comments and enable @11ty/eleventy-navigation plugin" git push origin main
هي دي كل الحكاية.
unknown block tag: comment
هيروح بعد الاستبدال الشامل.eleventyNavigation
هيروح بعد إضافة البلاجين.package-lock.json
بقى في الجذر واتدفع، خطوة npm ci
في الـ Actions هتعدّي عادي.لو لسه يحصل خطأ، ابعتلي أول 15 سطر من 404.md
وأول 40 سطر من _includes/layouts/base.njk
وأنا هعدّلهم لك فورًا هنا.
ده ملف البيزك كامل زي ما طلبت
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>{{ title or metadata.title }}</title> <meta name="viewport" content="width=device-width, initial-scale=1">text{# ستايلات القالب #} <link rel="stylesheet" href="{{ '/css/w3.css' | url }}"> <link rel="stylesheet" href="{{ '/css/style.css?v=11' | url }}"> {# Font Awesome للأيقونات #} <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> {# Favicon (اختياري) #} <link rel="icon" href="{{ '/img/favicon.png' | url }}"> <style> /* الصورة في الهيدر بدون إطار أو دائرة */ #home img { border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; outline: 0 !important; } /* العرض الافتراضي للسيدبار والخلفية الأساسية */ .w3-sidebar { width: 120px; background: #222; } /* محتوى الصفحة يتحرك يمينًا بمقدار عرض السيدبار */ #main { margin-left: 120px; } /* تنظيف السايدبار وتصغير الأيقونات */ nav.w3-sidebar { background: #111 !important; } nav.w3-sidebar .w3-bar-item { background: transparent !important; border: 0 !important; box-shadow: none !important; } nav.w3-sidebar .w3-bar-item i { font-size: 20px !important; display: block; margin: 8px auto 4px; } nav.w3-sidebar .w3-bar-item p { font-size: 12px !important; margin: 0; } nav.w3-sidebar .w3-bar-item.sidebar-link { padding: 14px 8px !important; } nav.w3-sidebar .w3-dark-grey, nav.w3-sidebar .w3-grey, nav.w3-sidebar .w3-gray {
background: transparent !important;
}
nav.w3-sidebar .w3-bar-item:hover {
background: rgba(255,255,255,0.06) !important;
}
</head> <body class="w3-black"> <!-- Sidebar --> <nav class="w3-sidebar w3-bar-block w3-small w3-hide-small w3-center" style="z-index:3"> <!-- Home --> <a href="/#" class="w3-bar-item w3-button sidebar-link" title="Home" aria-label="Home"> <i class="fa fa-home"></i> <p>Home</p> </a>text{% raw %} /* موبايل: ألغِ الإزاحة */ @media only screen and (max-width:600px) { #main { margin-left: 0; } } {% endraw %} </style>
<!-- Projects (بدل Photos) -->text<!-- About --> <a href="/#about" class="w3-bar-item w3-button sidebar-link" title="About" aria-label="About"> <i class="fa fa-id-card" aria-hidden="true"></i> <p>About</p> </a>
</body> </html>text<a href="/projects/" class="w3-bar-item w3-button sidebar-link" title="Projects" aria-label="Projects"> <i class="fa fa-film" aria-hidden="true"></i> <p>Projects</p> </a> <!-- Contact --> <a href="/#contact" class="w3-bar-item w3-button sidebar-link" title="Contact" aria-label="Contact"> <i class="fa fa-commenting" aria-hidden="true"></i> <p>Contact</p> </a> </nav> <!-- Navbar on small screens --> <div class="w3-top w3-hide-large w3-hide-medium" id="myNavbar"> <div class="w3-bar w3-black w3-opacity w3-hover-opacity-off w3-center w3-small"> {%- for entry in collections.all | eleventyNavigation %} <a href="{{ entry.url | url }}" class="w3-bar-item w3-button" style="width:20% !important">{{ entry.title }}</a> {%- endfor %} </div> </div> <div class="w3-padding-large" id="main"> <main {% if templateClass %} class="{{ templateClass }}"{% endif %}> {{ content | safe }} </main> <!-- Footer --> <footer class="w3-content w3-padding-64 w3-text-grey w3-xlarge"> <i class="fa fa-facebook-official w3-hover-opacity"></i> <i class="fa fa-instagram w3-hover-opacity"></i> <i class="fa fa-snapchat w3-hover-opacity"></i> <i class="fa fa-pinterest-p w3-hover-opacity"></i> <i class="fa fa-twitter w3-hover-opacity"></i> <i class="fa fa-linkedin w3-hover-opacity"></i> <p class="w3-medium"> Powered by <a href="https://www.w3schools.com/w3css/default.asp" target="_blank" class="w3-hover-text-green">w3.css</a> </p> </footer> </div> <!-- Current page: {{ page.url | url }} -->
تمام يا يوسف! 👍
الملف base.njk
واضح إنه بيستخدم الفِلتر eleventyNavigation
هنا:
njk{%- for entry in collections.all | eleventyNavigation %} <a href="{{ entry.url | url }}" class="w3-bar-item w3-button" style="width:20% !important">{{ entry.title }}</a> {%- endfor %}
وده هو سبب خطأ: filter not found: eleventyNavigation
. عندك حلّين: إمّا تفعّل الـ Plugin الرسمي، أو تشيل الاعتماد عليه وتخلّي القايمة ثابتة.
(لو كنت ثبّتّه قبل كده مفيش ضرر)
bashnpm i -D @11ty/eleventy-navigation
.eleventy.js
(انسخه كاملًا)js// .eleventy.js const pluginRss = require("@11ty/eleventy-plugin-rss"); const pluginNavigation = require("@11ty/eleventy-navigation"); module.exports = function(eleventyConfig) { // Plugins eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginNavigation); // Static passthrough eleventyConfig.addPassthroughCopy({ "img": "img" }); eleventyConfig.addPassthroughCopy({ "css": "css" }); eleventyConfig.addPassthroughCopy({ "files": "files" }); // Date filters (fallbacks) eleventyConfig.addFilter("htmlDateString", (d) => new Date(d).toISOString().slice(0, 10)); eleventyConfig.addFilter("readableDate", (d) => new Date(d).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" }) ); // Tags utilities زي Eleventy Base Blog const EXCLUDED = new Set(["all","nav","post","posts"]); eleventyConfig.addFilter("filterTagList", (tags) => (tags || []).filter((t) => !EXCLUDED.has(t))); eleventyConfig.addCollection("tagList", (api) => { const set = new Set(); api.getAll().forEach((item) => { (item.data.tags || []).forEach((t) => { if(!EXCLUDED.has(t)) set.add(t); }); }); return Array.from(set).sort(); }); return { dir: { input: ".", includes: "_includes", data: "_data", output: "_site" }, htmlTemplateEngine: "njk", markdownTemplateEngine: "njk", templateFormats: ["njk","md","html"] }; };
ملاحظة: علشان القايمة تتعبّى تلقائيًا، زوّد في الصفحات اللي عايزها تظهر بالناڤ: في الـ front matter:
yaml--- title: About eleventyNavigation: key: About order: 2 ---
(اعمل نفس الفكرة لـ Home/Projects/Contact… القيم
key
وorder
اللي تعجبك)
{% comment %}
اختفت فعلًاتأكّد إن ملف 404.md
مفيهوش أي {% comment %}
متبقّي:
bashgrep -n "{% *comment" 404.md || echo "OK: no comment blocks" grep -n "{% *endcomment" 404.md || echo "OK: no endcomment blocks"
لو طلع أي سطر، بدّله يدويًا بـ {# ... #}
.
bashnpx @11ty/eleventy --version npx @11ty/eleventy git add -A git commit -m "Enable @11ty/eleventy-navigation and clean Nunjucks comments" git push origin main
ده يقفل خطأ eleventyNavigation
وغلطة التعليقات.
لو مش عايز البلاجين، بدّل بلوك الناڤ للموبايل في base.njk
بـ قايمة ثابتة (زي السايدبار):
njk<div class="w3-top w3-hide-large w3-hide-medium" id="myNavbar"> <div class="w3-bar w3-black w3-opacity w3-hover-opacity-off w3-center w3-small"> <a href="/#" class="w3-bar-item w3-button" style="width:25% !important">Home</a> <a href="/#about" class="w3-bar-item w3-button" style="width:25% !important">About</a> <a href="/projects/" class="w3-bar-item w3-button" style="width:25% !important">Projects</a> <a href="/#contact" class="w3-bar-item w3-button" style="width:25% !important">Contact</a> </div> </div>
وبكده نشيل الفِلتر eleventyNavigation
من القالب وبالتالي الخطأ يختفي بدون إضافة أي باكدچ.
# ...
في نفس السطر؛ ده كان سبب Error قبل كده.package-lock.json
متضاف ومتبوش (عملت ده صح 👍).npm ci
npx @11ty/eleventy
(أو npm run build
لو ضايف سكريبت)actions/upload-pages-artifact@v3
بملف _site
actions/deploy-pages@v4
yamlpermissions: contents: read pages: write id-token: write
لو تحب، ابعتلي 404.md
(أول 15 سطر) وأي صفحة حاطط فيها eleventyNavigation:
في الـ front matter، وأنا أظبطلك القيم المناسبة بسرعة.