create-site

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create a New AEM Edge Delivery Site

创建全新的AEM Edge Delivery站点

This skill walks through the full onboarding flow for a new AEM Edge Delivery site. It handles everything that can be automated and clearly signals the steps that require human action.
本技能将引导完成新AEM Edge Delivery站点的完整入门流程。它会处理所有可自动化的步骤,并明确指出需要人工操作的环节。

When to Use This Skill

何时使用此技能

Use this skill when:
  • A user wants to create a brand-new AEM Edge Delivery site from scratch
  • A user asks to "set up a new site", "create a new EDS project", or "onboard a new site"
  • No GitHub repository or DA content exists yet for the project
Do NOT use this skill for:
  • Importing or migrating existing pages (use page-import skill)
  • Building or modifying blocks on an existing site (use content-driven-development skill)
在以下场景使用本技能:
  • 用户想要从零开始创建全新的AEM Edge Delivery站点
  • 用户要求“搭建新站点”、“创建新EDS项目”或“接入新站点”
  • 项目尚无GitHub仓库或DA内容
请勿在以下场景使用本技能:
  • 导入或迁移现有页面(使用page-import技能)
  • 在现有站点上构建或修改组件(使用content-driven-development技能)

Prerequisites

前提条件

  • A GitHub account with permission to create repositories in the target org
  • An Adobe IMS account with access to DA (da.live)
  • gh
    CLI authenticated (
    gh auth status
    ) or a GitHub personal access token with
    repo
    scope
  • Node.js (for DA token management via da-auth-helper)
  • 拥有目标组织中创建仓库权限的GitHub账户
  • 有权访问DA(da.live)的Adobe IMS账户
  • gh
    CLI已认证(
    gh auth status
    ),或拥有带有
    repo
    权限的GitHub个人访问令牌
  • Node.js(用于通过da-auth-helper管理DA令牌)

Related Skills

相关技能

  • page-import — Import existing pages into the newly created site
  • content-driven-development — Build and modify blocks once the site exists
  • building-blocks — Implement new block code

  • page-import — 将现有页面导入新建站点
  • content-driven-development — 站点创建完成后构建和修改组件
  • building-blocks — 实现新的组件代码

Step 0: Create TodoList

步骤0:创建待办清单

Create a checklist to track progress (use your agent's task-tracking tool if available):
  1. Gather inputs — org, repo name, site name collected
  2. Create GitHub repository — repo created from boilerplate template
  3. Install aem-code-sync (human action) — GitHub App installed on repo
  4. Authenticate with DA — valid IMS token obtained
  5. Create initial content in DA — nav, footer, index created
  6. Trigger preview — all three paths return 200/201
  7. Hand off — preview URL and DA links delivered to user

创建一个清单来跟踪进度(如果有代理的任务跟踪工具,请使用该工具):
  1. 收集输入信息 — 已收集组织、仓库名称、站点名称
  2. 创建GitHub仓库 — 基于模板仓库创建新仓库
  3. 安装aem-code-sync(人工操作)— 在仓库上安装GitHub应用
  4. 通过DA认证 — 获取有效的IMS令牌
  5. 在DA中创建初始内容 — 创建导航页、页脚、首页
  6. 触发预览 — 三个路径均返回200/201状态码
  7. 交付 — 将预览URL和DA链接提供给用户

Step 1: Gather Inputs

步骤1:收集输入信息

Ask the user for the following. Do not proceed until all required inputs are provided.
  1. GitHub org — the GitHub organization or username where the repo will be created (e.g.
    my-org
    )
  2. Project name — the repository name, lowercase, hyphens only (e.g.
    my-site
    )
  3. Site name — the human-readable name used in content (e.g.
    My Site
    ). If not provided, derive it from the project name.
Store as:
{{ORG}}
,
{{REPO}}
,
{{SITE_NAME}}

向用户询问以下信息,在获取所有必填信息前请勿继续。
  1. GitHub组织 — 仓库将创建的GitHub组织或用户名(例如:
    my-org
  2. 项目名称 — 仓库名称,小写,仅使用连字符(例如:
    my-site
  3. 站点名称 — 内容中使用的易读名称(例如:
    My Site
    )。如果未提供,从项目名称推导。
存储为:
{{ORG}}
,
{{REPO}}
,
{{SITE_NAME}}

Step 2: Create GitHub Repository

步骤2:创建GitHub仓库

Create a new repository using the
adobe/aem-boilerplate
template.
Option A — GitHub CLI (preferred, handles auth automatically):
bash
gh repo create {{ORG}}/{{REPO}} \
  --template adobe/aem-boilerplate \
  --description "{{SITE_NAME}} — AEM Edge Delivery site" \
  --public
Check if
gh
is available with
gh auth status
. If not authenticated, run
gh auth login
first.
Option B — GitHub API (if
gh
CLI is not available):
POST https://api.github.com/repos/adobe/aem-boilerplate/generate
Authorization: Bearer {{GITHUB_TOKEN}}
Content-Type: application/json

{
  "owner": "{{ORG}}",
  "name": "{{REPO}}",
  "description": "{{SITE_NAME}} — AEM Edge Delivery site",
  "private": false,
  "include_all_branches": false
}
To obtain a token: https://github.com/settings/tokens/new — scope:
repo
.
Success: HTTP 201 (API) or exit code 0 (CLI). The repo is now live at
https://github.com/{{ORG}}/{{REPO}}
.

使用
adobe/aem-boilerplate
模板创建新仓库。
选项A — GitHub CLI(推荐,自动处理认证):
bash
gh repo create {{ORG}}/{{REPO}} \
  --template adobe/aem-boilerplate \
  --description "{{SITE_NAME}} — AEM Edge Delivery site" \
  --public
使用
gh auth status
检查
gh
是否可用。如果未认证,先运行
gh auth login
选项B — GitHub API(如果
gh
CLI不可用):
POST https://api.github.com/repos/adobe/aem-boilerplate/generate
Authorization: Bearer {{GITHUB_TOKEN}}
Content-Type: application/json

{
  "owner": "{{ORG}}",
  "name": "{{REPO}}",
  "description": "{{SITE_NAME}} — AEM Edge Delivery site",
  "private": false,
  "include_all_branches": false
}
获取令牌:https://github.com/settings/tokens/new — 权限范围:
repo
成功标志: API返回HTTP 201,或CLI返回退出码0。仓库现已上线,地址为
https://github.com/{{ORG}}/{{REPO}}

Step 3: Install aem-code-sync (human action required)

步骤3:安装aem-code-sync(需人工操作)

The aem-code-sync GitHub App connects the repository to AEM's content delivery pipeline. This step cannot be automated — the user must complete it in the browser.
Tell the user:
Action required: Install the AEM Code Sync app on your new repository.
  1. Open this URL: https://github.com/apps/aem-code-sync/installations/new
  2. Under "Repository access", select Only select repositories
  3. Choose {{ORG}}/{{REPO}} from the list
  4. Click Save
Reply "done" when complete.
Wait for confirmation before proceeding.
Verify: After confirmation, check that
https://admin.hlx.page/status/{{ORG}}/{{REPO}}/main/
returns a valid JSON response (not 404). If it does, the app is correctly installed.

aem-code-sync GitHub应用将仓库连接到AEM的内容交付管道。此步骤无法自动化 — 用户必须在浏览器中完成。
告知用户:
需要执行操作: 在新仓库上安装AEM Code Sync应用。
  1. 打开此链接:https://github.com/apps/aem-code-sync/installations/new
  2. 在“仓库访问”下,选择仅选择仓库
  3. 从列表中选择**{{ORG}}/{{REPO}}**
  4. 点击保存
完成后回复“done”。
等待确认后再继续。
验证: 确认后,检查
https://admin.hlx.page/status/{{ORG}}/{{REPO}}/main/
是否返回有效的JSON响应(非404)。如果是,则应用已正确安装。

Step 4: Authenticate with DA

步骤4:通过DA认证

DA requires Adobe IMS authentication. Choose the appropriate path:
Option A — da-auth-helper (preferred)
da-auth-helper
(https://github.com/adobe-rnd/da-auth-helper) caches IMS tokens at
~/.aem/da-token.json
. Always check the cache first before triggering a new OAuth flow.
  1. Check for a valid cached token:
bash
node -e "
  const fs = require('fs');
  const p = process.env.HOME + '/.aem/da-token.json';
  if (!fs.existsSync(p)) { console.log('No cache'); process.exit(1); }
  const t = JSON.parse(fs.readFileSync(p));
  console.log('Valid:', t.expires_at > Date.now());
  console.log('Expires:', new Date(t.expires_at).toISOString());
"
  1. If valid, capture the token and skip to Step 5:
bash
DA_TOKEN=$(node -e "const t = require(process.env.HOME + '/.aem/da-token.json'); process.stdout.write(t.access_token);")
  1. If missing or expired, install da-auth-helper from GitHub (it is not published to npm) and refresh:
bash
npm install -g github:adobe-rnd/da-auth-helper
da-auth-helper token
This opens a browser for Adobe IMS login and writes the new token to
~/.aem/da-token.json
. Then capture it as in step 2.
Option B — DA MCP is configured
If the DA MCP server is available, trigger the authentication tool to start the OAuth flow and share the authorization URL with the user.
Option C — Manual token
Ask the user to obtain an IMS token from their browser (e.g. from the DA network tab or an existing session) and paste it. Store as
{{DA_TOKEN}}
.

DA需要Adobe IMS认证。选择合适的方式:
选项A — da-auth-helper(推荐)
da-auth-helper
(https://github.com/adobe-rnd/da-auth-helper) 将IMS令牌缓存到
~/.aem/da-token.json
。在触发新的OAuth流程前,始终先检查缓存。
  1. 检查是否有有效的缓存令牌:
bash
node -e "
  const fs = require('fs');
  const p = process.env.HOME + '/.aem/da-token.json';
  if (!fs.existsSync(p)) { console.log('No cache'); process.exit(1); }
  const t = JSON.parse(fs.readFileSync(p));
  console.log('Valid:', t.expires_at > Date.now());
  console.log('Expires:', new Date(t.expires_at).toISOString());
"
  1. 如果有效,捕获令牌并跳至步骤5:
bash
DA_TOKEN=$(node -e "const t = require(process.env.HOME + '/.aem/da-token.json'); process.stdout.write(t.access_token);")
  1. 如果令牌缺失或过期,从GitHub安装da-auth-helper(未发布到npm)并刷新:
bash
npm install -g github:adobe-rnd/da-auth-helper
da-auth-helper token
这会打开浏览器进行Adobe IMS登录,并将新令牌写入
~/.aem/da-token.json
。然后按照步骤2捕获令牌。
选项B — 已配置DA MCP
如果DA MCP服务器可用,触发认证工具启动OAuth流程,并将授权URL分享给用户。
选项C — 手动令牌
要求用户从浏览器获取IMS令牌(例如从DA的网络标签或现有会话)并粘贴。存储为
{{DA_TOKEN}}

Step 5: Create Initial Content in DA

步骤5:在DA中创建初始内容

Create the three mandatory pages every EDS site requires. Use the templates below exactly — they are pre-validated for EDS compliance.
Option A — DA MCP: Call the DA create source tool three times with the content below.
Option B — DA API:
Write each file to a temp file first, then POST using
@
syntax. Inline multiline content with
-F 'data=...'
causes curl to fail (exit 26). Use
/usr/bin/curl
explicitly to avoid PATH resolution issues in subshells.
bash
cat > /tmp/nav.html << 'EOF'
<nav content>
EOF
/usr/bin/curl -s -o /dev/null -w "%{http_code}" -X POST "https://admin.da.live/source/{{ORG}}/{{REPO}}/nav.html" \
  -H "Authorization: Bearer {{DA_TOKEN}}" \
  -F "data=@/tmp/nav.html;type=text/html"
Repeat for
footer.html
and
index.html
.
Verify: After each POST, expect HTTP 201. If you get 401, the token has expired — return to Step 4.

创建每个EDS站点都需要的三个必填页面。请严格使用以下模板 — 它们已预先验证符合EDS规范。
选项A — DA MCP: 使用以下内容调用三次DA创建源工具。
选项B — DA API:
先将每个文件写入临时文件,然后使用
@
语法进行POST。在
-F 'data=...'
中使用多行内联内容会导致curl失败(退出码26)。显式使用
/usr/bin/curl
以避免子shell中的PATH解析问题。
bash
cat > /tmp/nav.html << 'EOF'
<nav content>
EOF
/usr/bin/curl -s -o /dev/null -w "%{http_code}" -X POST "https://admin.da.live/source/{{ORG}}/{{REPO}}/nav.html" \
  -H "Authorization: Bearer {{DA_TOKEN}}" \
  -F "data=@/tmp/nav.html;type=text/html"
footer.html
index.html
重复上述操作。
验证: 每次POST后,预期返回HTTP 201。如果返回401,说明令牌已过期 — 返回步骤4。

nav.html

nav.html

html
<main>
  <div>
    <p><a href="/">{{SITE_NAME}}</a></p>
  </div>
  <div>
    <ul>
      <li><a href="/">Home</a></li>
    </ul>
  </div>
  <div></div>
</main>
html
<main>
  <div>
    <p><a href="/">{{SITE_NAME}}</a></p>
  </div>
  <div>
    <ul>
      <li><a href="/">Home</a></li>
    </ul>
  </div>
  <div></div>
</main>

footer.html

footer.html

html
<main>
  <div>
    <p>© 2024 {{SITE_NAME}}. All rights reserved.</p>
  </div>
</main>
html
<main>
  <div>
    <p>© 2024 {{SITE_NAME}}. All rights reserved.</p>
  </div>
</main>

index.html

index.html

html
<main>
  <div>
    <h1>Welcome to {{SITE_NAME}}</h1>
    <p>Your new site is ready. Start editing this page in DA.</p>
  </div>
</main>

html
<main>
  <div>
    <h1>Welcome to {{SITE_NAME}}</h1>
    <p>Your new site is ready. Start editing this page in DA.</p>
  </div>
</main>

Step 6: Trigger Preview

步骤6:触发预览

Preview pulls the DA content into the AEM delivery pipeline and makes it accessible on the
.aem.page
domain.
DA-sourced content requires the Bearer token on preview requests — even for public repos. Use
/usr/bin/curl
explicitly.
bash
/usr/bin/curl -s -o /dev/null -w "%{http_code}" -X POST "https://admin.hlx.page/preview/{{ORG}}/{{REPO}}/main/nav" \
  -H "Authorization: Bearer {{DA_TOKEN}}"
/usr/bin/curl -s -o /dev/null -w "%{http_code}" -X POST "https://admin.hlx.page/preview/{{ORG}}/{{REPO}}/main/footer" \
  -H "Authorization: Bearer {{DA_TOKEN}}"
/usr/bin/curl -s -o /dev/null -w "%{http_code}" -X POST "https://admin.hlx.page/preview/{{ORG}}/{{REPO}}/main/" \
  -H "Authorization: Bearer {{DA_TOKEN}}"
Success: HTTP 200 or 201 for each. The homepage is now live at:
https://main--{{REPO}}--{{ORG}}.aem.page/

预览会将DA内容拉入AEM交付管道,并使其在
.aem.page
域名上可访问。
DA源内容的预览请求需要Bearer令牌 — 即使是公共仓库也是如此。显式使用
/usr/bin/curl
bash
/usr/bin/curl -s -o /dev/null -w "%{http_code}" -X POST "https://admin.hlx.page/preview/{{ORG}}/{{REPO}}/main/nav" \
  -H "Authorization: Bearer {{DA_TOKEN}}"
/usr/bin/curl -s -o /dev/null -w "%{http_code}" -X POST "https://admin.hlx.page/preview/{{ORG}}/{{REPO}}/main/footer" \
  -H "Authorization: Bearer {{DA_TOKEN}}"
/usr/bin/curl -s -o /dev/null -w "%{http_code}" -X POST "https://admin.hlx.page/preview/{{ORG}}/{{REPO}}/main/" \
  -H "Authorization: Bearer {{DA_TOKEN}}"
成功标志: 每个请求均返回HTTP 200或201。首页现已上线,地址为:
https://main--{{REPO}}--{{ORG}}.aem.page/

Step 7: Confirm and Hand Off

步骤7:确认并交付

Tell the user:
Your site is ready!
  • Preview:
    https://main--{{REPO}}--{{ORG}}.aem.page/
  • Browse content in DA:
    https://da.live/#/{{ORG}}/{{REPO}}/
  • Edit homepage:
    https://da.live/edit#/{{ORG}}/{{REPO}}/index
  • Edit nav:
    https://da.live/edit#/{{ORG}}/{{REPO}}/nav
  • Edit footer:
    https://da.live/edit#/{{ORG}}/{{REPO}}/footer
  • GitHub repo:
    https://github.com/{{ORG}}/{{REPO}}
To start developing locally:
bash
git clone https://github.com/{{ORG}}/{{REPO}}.git
cd {{REPO}}
npm install
aem up
What would you like to do next — add more pages, customize a block, or set up a custom domain?

告知用户:
您的站点已准备就绪!
  • 预览地址:
    https://main--{{REPO}}--{{ORG}}.aem.page/
  • 在DA中浏览内容:
    https://da.live/#/{{ORG}}/{{REPO}}/
  • 编辑首页:
    https://da.live/edit#/{{ORG}}/{{REPO}}/index
  • 编辑导航:
    https://da.live/edit#/{{ORG}}/{{REPO}}/nav
  • 编辑页脚:
    https://da.live/edit#/{{ORG}}/{{REPO}}/footer
  • GitHub仓库:
    https://github.com/{{ORG}}/{{REPO}}
如需开始本地开发:
bash
git clone https://github.com/{{ORG}}/{{REPO}}.git
cd {{REPO}}
npm install
aem up
接下来您想做什么 — 添加更多页面、自定义组件,还是设置自定义域名?

Troubleshooting

故障排除

SymptomLikely causeFix
Step 2 returns 422Repo name already existsAsk user for a different name
Step 3 verify returns 404aem-code-sync not installedRe-send the installation URL
Step 4 cached token missing/expiredNo prior DA session on this machineInstall da-auth-helper from GitHub (
npm install -g github:adobe-rnd/da-auth-helper
) and run
da-auth-helper token
Step 5 curl exits with code 26Inline multiline content in
-F
flag
Write content to a temp file and use
@/tmp/file.html
syntax
Step 5 returns 401Expired or missing IMS tokenRe-check
~/.aem/da-token.json
expiry; ask user for a fresh token
Step 5 returns 403Token lacks permission for this org/repoConfirm the user has write access to
{{ORG}}/{{REPO}}
in DA
Step 6 returns 401DA-sourced content requires auth on previewAdd
-H "Authorization: Bearer {{DA_TOKEN}}"
to preview requests
Step 6 returns 404aem-code-sync not installed correctlyVerify Step 3, then retry
curl: command not found
in scripts
PATH not resolved in subshellUse
/usr/bin/curl
explicitly
Preview URL shows blank pagenav or index not previewedRe-run Step 6 for the failing path

症状可能原因解决方法
步骤2返回422仓库名称已存在请求用户提供其他名称
步骤3验证返回404未安装aem-code-sync重新发送安装链接
步骤4缓存令牌缺失/过期此机器上无先前的DA会话从GitHub安装da-auth-helper(
npm install -g github:adobe-rnd/da-auth-helper
)并运行
da-auth-helper token
步骤5 curl返回退出码26
-F
标志中使用了多行内联内容
将内容写入临时文件并使用
@/tmp/file.html
语法
步骤5返回401IMS令牌过期或缺失重新检查
~/.aem/da-token.json
的过期时间;请求用户提供新令牌
步骤5返回403令牌缺少此组织/仓库的权限确认用户在DA中拥有
{{ORG}}/{{REPO}}
的写入权限
步骤6返回401DA源内容的预览请求需要认证在预览请求中添加
-H "Authorization: Bearer {{DA_TOKEN}}"
步骤6返回404aem-code-sync安装不正确验证步骤3,然后重试
脚本中出现
curl: command not found
子shell中未解析PATH显式使用
/usr/bin/curl
预览URL显示空白页面未预览导航或首页为失败路径重新运行步骤6

Reference

参考资料

DA URL patterns

DA URL模式

  • Browse folder:
    https://da.live/#/{{org}}/{{repo}}{{folder-path}}
  • Edit HTML document:
    https://da.live/edit#/{{org}}/{{repo}}{{path-without-extension}}
  • Edit JSON/sheet:
    https://da.live/sheet#/{{org}}/{{repo}}{{path-without-extension}}
  • 浏览文件夹:
    https://da.live/#/{{org}}/{{repo}}{{folder-path}}
  • 编辑HTML文档:
    https://da.live/edit#/{{org}}/{{repo}}{{path-without-extension}}
  • 编辑JSON/表格:
    https://da.live/sheet#/{{org}}/{{repo}}{{path-without-extension}}