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

fix: incorrect hash tag link #140

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ enum Target {
```json
{
"name": "string", // 标签名称
"permalink": "string", // 标签链接
"momentCount": 0 // 标签所属的 moment 数量
}
```
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "com.github.node-gradle.node" version "5.0.0"
id "io.freefair.lombok" version "8.0.0-rc2"
id "run.halo.plugin.devtools" version "0.1.1"
id "run.halo.plugin.devtools" version "0.4.1"
id 'java'
}

Expand Down Expand Up @@ -46,7 +46,7 @@ build {
}

halo {
version = '2.17.0'
version = '2.20'
debug = true;
}

Expand Down
2 changes: 1 addition & 1 deletion console/src/extensions/tags/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const TagsExtension = Mark.create<TagOptions>({
default: null,
renderHTML(attributes) {
return {
href: `?tag=${encodeURI(attributes.tagText)}`,
href: `/moments?tag=${encodeURI(attributes.tagText)}`,
"data-pjax": "",
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import static run.halo.app.extension.index.query.QueryFactory.equal;

import jakarta.annotation.Nonnull;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.domain.Sort;
import org.springframework.web.util.UriUtils;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import run.halo.app.core.extension.Counter;
Expand Down Expand Up @@ -109,6 +111,8 @@ public Flux<MomentTagVo> listAllTags() {
.map(count -> MomentTagVo.builder()
.name(groupedFlux.key())
.momentCount(count.intValue())
.permalink("/moments?tag=" + UriUtils.encode(groupedFlux.key(),
StandardCharsets.UTF_8))
.build()
)
);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/run/halo/moments/vo/MomentTagVo.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package run.halo.moments.vo;

import lombok.Builder;
import lombok.ToString;
import lombok.Value;
import org.springframework.web.util.UriUtils;
import java.nio.charset.StandardCharsets;

@Value
@Builder
public class MomentTagVo {

String name;

String permalink;

Integer momentCount;
}
Loading