Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码注入功能可否支持Thymeleaf #5922

Closed
yefoenix opened this issue May 16, 2024 · 5 comments
Closed

代码注入功能可否支持Thymeleaf #5922

yefoenix opened this issue May 16, 2024 · 5 comments
Labels
triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@yefoenix
Copy link

你当前使用的版本

2.15.0

描述一下此特性

希望代码注入功能能够支持Thymeleaf,
例如:
在代码注入功能中,为内容页面Head标签添加类似以下代码

<meta property="og:image" th:content="${post.spec.cover}">

前端应当转化为

<meta property="og:image" content="文章封面图片实际地址">

附加信息

No response

@JohnNiang
Copy link
Member

JohnNiang commented May 16, 2024

如果你指的是系统设置中代码注入功能,该功能面向的是所有页面,不仅仅是文章,所以无法知道具体哪些变量可以使用。

不过你当前的需求可以通过插件实现文章 Head 的处理。具体请参考文档:https://docs.halo.run/developer-guide/plugin/api-reference/server/extension-points/template-head-processor

/triage needs-information

@f2c-ci-robot f2c-ci-robot bot added the triage/needs-information Indicates an issue needs more information in order to work on it. label May 16, 2024
@yefoenix
Copy link
Author

yefoenix commented May 16, 2024

Reply to @JohnNiang

指的是,系统设置中代码注入功能。
目前这个功能支持分别设置全局页 Head 标签和内容页 Head 标签,因此可以进行一定程度的区分。
image

实际上我目前的需求是暂时通过修改主题的 head 模板来实现了,就是这样不太优雅。

@guqing
Copy link
Member

guqing commented May 17, 2024

有现成的 SEO 插件可以支持你说的功能,或者你可以选择修改主题模板来实现,这里的内容页不仅仅只是说的文章详情还有自定义页面等因此你这样的写法是有问题的

@ruibaby
Copy link
Member

ruibaby commented May 24, 2024

此 issue 已不再活跃,我将关闭此 issue。

/close

@f2c-ci-robot f2c-ci-robot bot closed this as completed May 24, 2024
Copy link

f2c-ci-robot bot commented May 24, 2024

@ruibaby: Closing this issue.

In response to this:

此 issue 已不再活跃,我将关闭此 issue。

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

4 participants