halo-dev / plugin-sitemap

Halo 2.0 的站点 Sitemap 生成插件
https://halo.run/store/apps/app-QDFMI
GNU General Public License v3.0
6 stars 6 forks source link

v1.0.3 新增功能和修复问题 #16

Closed carolcoral closed 1 year ago

carolcoral commented 1 year ago

Change

为了解决了站点在使用反向代理、NG代理、CDN回源等情况下,domain://sitemap.xml 中的站点地址与实际期望的访问地址不一致问题

FIX

f2c-ci-robot[bot] commented 1 year ago

@carolcoral: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
JohnNiang commented 1 year ago

关于 Site URL 的配置问题,我有一个建议:

Halo 目前在 HaloProperties 中提供了 externalUrl 的配置,主要是为了避免用户在各个插件都手动配置它。这里建议直接调用 ExternalURLSupplier#getURL(HttpRequest)方法获取 Site URL。这里将优先返回用户配置的 halo.externalUrl,其次才会解析当前用户所请求的域名。

如果无法正常获取当前用户所请求的域名,大概率是因为反向代理工具(如 Nginx)没有正确代理 X-Forward-For 头。

JohnNiang commented 1 year ago

Hi @carolcoral ,我发现在当前版本中无法正常调用 ExternalUrlSupplier#getURL(HttpRequest) 方法,我将尝试升级一下 Halo 的依赖来支持。


已升级。

f2c-ci-robot[bot] commented 1 year ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: To complete the pull request process, please assign guqing after the PR has been reviewed. You can assign the PR to them by writing /assign @guqing in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/halo-dev/plugin-sitemap/blob/main/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
carolcoral commented 1 year ago

change

  1. 删除无效类
  2. 变更自定义站点参数为动态获取(不再需要重启插件)
  3. 解决代码冲突合并robots.txt 功能
carolcoral commented 1 year ago

关于 Site URL 的配置问题,我有一个建议:

Halo 目前在 HaloProperties 中提供了 externalUrl 的配置,主要是为了避免用户在各个插件都手动配置它。这里建议直接调用 ExternalURLSupplier#getURL(HttpRequest)方法获取 Site URL。这里将优先返回用户配置的 halo.externalUrl,其次才会解析当前用户所请求的域名。

如果无法正常获取当前用户所请求的域名,大概率是因为反向代理工具(如 Nginx)没有正确代理 X-Forward-For 头。

不仅仅是存在NG代理设置问题导致的获取站点地图和期望地址不一致问题。同时存在多重穿透和CDN源站方式导致的获取到的站点地址加上了源站地址的端口(实际上访问地址是没有端口的,仅源站存在端口)

guqing commented 1 year ago

希望一个 PR 只单纯的解决一个问题,不要在一个 PR 中做多件事,并且希望先提一个 issue 来与之关联让我们知道到底发生了什么事,不然会给 reviewer 带来困扰。

目前你的 PR 包含了之前已经合并的改动,很难 review,建议:

# https or ssh
git remote add upstream https://github.com/halo-dev/plugin-sitemap.git
git fetch upstream/main
git merge upstream/main
git reset --soft upstream/main
git add .
git commit -m '这里改为你的提交信息'
git push origin HEAD -f

参考 https://git-scm.com/docs/git-reset

carolcoral commented 1 year ago

希望一个 PR 只单纯的解决一个问题,不要在一个 PR 中做多件事,并且希望先提一个 issue 来与之关联让我们知道到底发生了什么事,不然会给 reviewer 带来困扰。

目前你的 PR 包含了之前已经合并的改动,很难 review,建议:

# https or ssh
git remote add upstream https://github.com/halo-dev/plugin-sitemap.git
git fetch upstream/main
git merge upstream/main
git reset --soft upstream/main
git add .
git commit -m '这里改为你的提交信息'
git push origin HEAD -f

参考 https://git-scm.com/docs/git-reset

解决ISSUE:

  1. https://github.com/halo-dev/plugin-sitemap/issues/13
  2. https://github.com/halo-dev/plugin-sitemap/issues/11
  3. https://github.com/halo-dev/plugin-sitemap/issues/10

因为PR最开始仅仅解决 https://github.com/halo-dev/plugin-sitemap/issues/11 但未被接受PR。因此后续的commit被依次提交了。

carolcoral commented 1 year ago

目前来看:

  1. 支持自定义站点地址
  2. 支持自定义权重(针对全局权重一致无法对文章类权重进行变更的需求) https://github.com/halo-dev/plugin-sitemap/issues/10
  3. 支持站点地址中文章类型地址使用最后更新时间 https://github.com/halo-dev/plugin-sitemap/issues/10
  4. 支持自定义设置动态修改加载

如果依然不符合您的要求,请直接关闭当前PR吧,不想折腾了

ruibaby commented 1 year ago

如果依然不符合您的要求,请直接关闭当前PR吧,不想折腾了

实际上 reset 之后重新 commit 并强制推送即可,不过依旧感谢你参与贡献。

针对这个问题已经有了一个新的 PR:https://github.com/halo-dev/plugin-sitemap/pull/25,欢迎 Review 和测试。

/close

f2c-ci-robot[bot] commented 1 year ago

@ruibaby: Closed this PR.

In response to [this](https://github.com/halo-dev/plugin-sitemap/pull/16#issuecomment-1732826254): >> 如果依然不符合您的要求,请直接关闭当前PR吧,不想折腾了 > >实际上 reset 之后重新 commit 并强制推送即可,不过依旧感谢你参与贡献。 > >针对这个问题已经有了一个新的 PR:,欢迎 Review 和测试。 > >/close > > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.