Go to file
guqing 53ee2ea547
feat: support code snippet injection for theme template (#2377)
<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?
/kind feature
/milestone 2.0
/area core
<!--
添加其中一个类别:
Add one of the following kinds:

/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind improvement

适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:

/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->

#### What this PR does / why we need it:
主题模板渲染时支持代码片段自动注入

如何测试:
<img width="644" alt="image" src="https://user-images.githubusercontent.com/38999863/188456203-e43c56b0-a886-4feb-bc87-ed17b97ecc4d.png">

1. 文章页 head 注入
 对于文章当spec.htmlMetas字段存在数据时访问文章页面 post.html 会自动在该页面的 head 中插入 meta tag
例如
htmlMetas = [{"name":"keywords", "content": "Halo,Blog"}, {"property":"org:name", "content": "fake-name"}]
则在 post.html返回结果的 `<head></head>`中能看到
```
<meta name="keywords" content="Halo,Blog" />
<meta property="org:name" content="fake-name" />
```
2. 内容页注入
当在后台设置->代码注入的`内容页 head`中填写了内容则访问 post.html 和 page.html 时会自动注入到 head 标签中(需要主题的是 page.html 为自定义页面,该功能在另一个 PR 中还未合并,因此内容页注入目前只适用 post.html)
3. 全局 head
当在后台设置->代码注入的`全局 head` 中填写的内容,访问任意模板页面时都会自动注入到 head 标签中
4. 页脚
页脚自定注入不适合,一般由主题开发者选择位置注入,因此提供了一个`<halo:footer></halo:footer>`标签,当在模板页面使用了此标签则 后台设置->代码注入的`页脚`处填写的内容在渲染后会替换此标签

#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.

用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #2376

#### Special notes for your reviewer:
/cc @halo-dev/sig-halo 
#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
None
```
2022-09-07 06:12:11 +00:00
.github Change image name to halo-dev (#2264) 2022-07-19 23:47:36 +08:00
config/checkstyle chore: add checkstyle rule (#2091) 2022-05-17 06:46:11 +00:00
docs/developer-guide Add support for custom endpoints (#2223) 2022-07-08 04:40:13 +00:00
gradle/wrapper Create basic project structure for halo 2.0 (#1699) 2022-03-04 15:04:11 +08:00
hack chore: add cherry_pick_pull.sh for cherry-picking pull request (#1554) 2021-12-03 10:21:24 +08:00
src feat: support code snippet injection for theme template (#2377) 2022-09-07 06:12:11 +00:00
.editorconfig refactor: next line config (#1844) 2022-04-14 07:49:17 +00:00
.gitattributes Refactor .gitignore 2019-04-03 11:37:59 +08:00
.gitignore feat: add theme install endpoint (#2302) 2022-08-04 09:24:16 +00:00
CHANGELOG.md release: 1.5.0-alpha.1 (#1671) 2022-02-21 23:45:20 +08:00
CODE_OF_CONDUCT.md docs: add CODE_OF_CONDUCT.md (#2150) 2022-06-12 08:10:12 +00:00
CONTRIBUTING.md chore: add cherry_pick_pull.sh for cherry-picking pull request (#1554) 2021-12-03 10:21:24 +08:00
Dockerfile Refactor CICD for Halo next (#2236) 2022-07-12 11:01:00 +08:00
LICENSE Create LICENSE 2018-03-21 21:39:46 +08:00
OWNERS feat: add OWNERS file for prow (#1840) 2022-04-13 17:06:22 +08:00
README.md docs: add demo site (#1625) 2022-01-11 16:57:21 +08:00
SECURITY.md Update SECURITY.md 2021-09-29 20:43:15 +08:00
build.gradle feat: add post module basic implementation (#2326) 2022-08-22 07:32:11 +00:00
gradle.properties Create basic project structure for halo 2.0 (#1699) 2022-03-04 15:04:11 +08:00
gradlew Create basic project structure for halo 2.0 (#1699) 2022-03-04 15:04:11 +08:00
gradlew.bat Create basic project structure for halo 2.0 (#1699) 2022-03-04 15:04:11 +08:00
settings.gradle Create basic project structure for halo 2.0 (#1699) 2022-03-04 15:04:11 +08:00

README.md

Halo logo

Halo [ˈheɪloʊ],一款现代化的开源博客/CMS系统值得一试。

GitHub release GitHub All Releases Docker pulls GitHub last commit GitHub Workflow Status
官网 文档 社区 Gitee Telegram 频道


快速开始

Fat Jar

下载最新的 Halo 运行包:

curl -L https://github.com/halo-dev/halo/releases/download/v1.4.17/halo-1.4.17.jar --output halo.jar

其他地址:https://docs.halo.run/getting-started/downloads

java -jar halo.jar

Docker

docker run -it -d --name halo -p 8090:8090 -v ~/.halo:/root/.halo --restart=always halohub/halo

详细部署文档请查阅:https://docs.halo.run/getting-started/install/linux

在线体验

生态

项目 状态 描述
halo-admin npm release Web 管理端 UI已内置在主应用
js-sdk npm release JavaScript SDK
halo-comment npm release 独立评论组件,可以非常方便的集成到主题中
halo-comment-normal npm release 另外一款评论组件
halo-mobile-app 已停止维护 移动端管理 APP
tencent-cloudbase-halo 腾讯云 CloudBase 一键部署配置
halo-theme-* GitHub 上开源的 Halo 主题集合

许可证

license

Halo 使用 GPL-v3.0 协议开源,请遵守开源协议。

贡献

参考 CONTRIBUTING

状态

Repobeats analytics