b2c-content

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

B2C Content Skill

B2C 内容管理Skill

Use the
b2c
CLI to export and list Page Designer content from Salesforce B2C Commerce content libraries.
Tip: If
b2c
is not installed globally, use
npx @salesforce/b2c-cli
instead (e.g.,
npx @salesforce/b2c-cli content export homepage
).
使用
b2c
CLI从Salesforce B2C Commerce内容库中导出和列出Page Designer内容。
提示: 如果未全局安装
b2c
,请改用
npx @salesforce/b2c-cli
(例如:
npx @salesforce/b2c-cli content export homepage
)。

Examples

示例

Export Pages

导出页面

bash
undefined
bash
undefined

export a single page from a shared library

从共享库导出单个页面

b2c content export homepage --library SharedLibrary
b2c content export homepage --library SharedLibrary

export multiple pages

导出多个页面

b2c content export homepage about-us contact --library SharedLibrary
b2c content export homepage about-us contact --library SharedLibrary

export pages matching a regex pattern

导出匹配正则表达式模式的页面

b2c content export "hero-.*" --library SharedLibrary --regex
b2c content export "hero-.*" --library SharedLibrary --regex

export to a specific output directory

导出到指定的输出目录

b2c content export homepage --library SharedLibrary -o ./my-export
b2c content export homepage --library SharedLibrary -o ./my-export

export a specific component by ID

通过ID导出特定组件

b2c content export hero-banner --library SharedLibrary
b2c content export hero-banner --library SharedLibrary

export from a site-private library

从站点私有库导出

b2c content export homepage --library RefArch --site-library
b2c content export homepage --library RefArch --site-library

preview without downloading (dry run)

预览而不下载(试运行)

b2c content export homepage --library SharedLibrary --dry-run
b2c content export homepage --library SharedLibrary --dry-run

export with JSON output

以JSON格式导出

b2c content export homepage --library SharedLibrary --json
b2c content export homepage --library SharedLibrary --json

export from a local XML file (offline, no instance needed)

从本地XML文件导出(离线模式,无需连接实例)

b2c content export homepage --library SharedLibrary --library-file ./library.xml --offline
b2c content export homepage --library SharedLibrary --library-file ./library.xml --offline

filter pages by folder classification

按文件夹分类筛选页面

b2c content export homepage --library SharedLibrary --folder seasonal
b2c content export homepage --library SharedLibrary --folder seasonal

custom asset extraction paths

自定义资源提取路径

b2c content export homepage --library SharedLibrary -q "image.path" -q "video.url"
b2c content export homepage --library SharedLibrary -q "image.path" -q "video.url"

include orphan components in export

在导出中包含孤立组件

b2c content export homepage --library SharedLibrary --keep-orphans
undefined
b2c content export homepage --library SharedLibrary --keep-orphans
undefined

List Content

列出内容

bash
undefined
bash
undefined

list all content in a library

列出库中的所有内容

b2c content list --library SharedLibrary
b2c content list --library SharedLibrary

list only pages

仅列出页面

b2c content list --library SharedLibrary --type page
b2c content list --library SharedLibrary --type page

list including components

列出内容并包含组件

b2c content list --library SharedLibrary --components
b2c content list --library SharedLibrary --components

show tree structure

显示树形结构

b2c content list --library SharedLibrary --tree
b2c content list --library SharedLibrary --tree

list from a site-private library

从站点私有库列出内容

b2c content list --library RefArch --site-library
b2c content list --library RefArch --site-library

list from a local XML file

从本地XML文件列出内容

b2c content list --library SharedLibrary --library-file ./library.xml
b2c content list --library SharedLibrary --library-file ./library.xml

JSON output

以JSON格式输出

b2c content list --library SharedLibrary --json
undefined
b2c content list --library SharedLibrary --json
undefined

Configuration

配置

The
--library
flag can be configured in
dw.json
or
package.json
so you don't need to pass it every time:
json
// dw.json
{
  "hostname": "my-sandbox.demandware.net",
  "content-library": "SharedLibrary"
}
json
// package.json
{
  "b2c": {
    "contentLibrary": "SharedLibrary"
  }
}
With a configured library, commands become shorter:
bash
b2c content export homepage
b2c content list --type page
--library
参数可在
dw.json
package.json
中配置,这样就无需每次命令都传入该参数:
json
// dw.json
{
  "hostname": "my-sandbox.demandware.net",
  "content-library": "SharedLibrary"
}
json
// package.json
{
  "b2c": {
    "contentLibrary": "SharedLibrary"
  }
}
配置好库之后,命令会更简洁:
bash
b2c content export homepage
b2c content list --type page

More Commands

更多命令

See
b2c content --help
for a full list of available commands and options in the
content
topic.
查看
b2c content --help
获取
content
主题下的所有可用命令和选项。

Related Skills

相关技能

  • b2c-cli:b2c-site-import-export
    - Site archive import/export operations
  • b2c-cli:b2c-webdav
    - Low-level file operations on content libraries
  • b2c-cli:b2c-config
    - Configuration and credential management
  • b2c-cli:b2c-site-import-export
    - 站点归档导入/导出操作
  • b2c-cli:b2c-webdav
    - 内容库上的底层文件操作
  • b2c-cli:b2c-config
    - 配置和凭据管理