Add link to tags

This commit is contained in:
blankie 2023-04-29 15:02:31 +07:00
parent fd946d1336
commit 71994b234b
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 6 additions and 4 deletions

View File

@ -11,7 +11,7 @@ static inline Element generate_images(const httplib::Request& req, const Config&
static inline Element generate_preview_images(const httplib::Request& req, const Config& config, const Illust& illust);
static inline std::vector<blankie::html::Node> parse_description_line(const httplib::Request& req, const Config& config, std::string str);
static inline Element generate_description(const httplib::Request& req, const Config& config, const std::string& description);
static inline Element generate_illust_tags(const Illust& illust);
static inline Element generate_illust_tags(const httplib::Request& req, const Config& config, const Illust& illust);
static inline bool is_true(const std::string& str);
static inline std::string time_to_string(time_t time);
@ -49,7 +49,7 @@ void artworks_route(const httplib::Request& req, httplib::Response& res, const C
if (illust.comment) {
body.nodes.push_back(generate_description(req, config, *illust.comment));
}
body.nodes.push_back(generate_illust_tags(illust));
body.nodes.push_back(generate_illust_tags(req, config, illust));
body.nodes.push_back(Element("p", {time_to_string(illust.upload_time)}));
serve(req, res, config, std::move(illust.title), std::move(body));
}
@ -161,7 +161,7 @@ static inline Element generate_description(const httplib::Request& req, const Co
return p;
}
static inline Element generate_illust_tags(const Illust& illust) {
static inline Element generate_illust_tags(const httplib::Request& req, const Config& config, const Illust& illust) {
Element div("div", {{"class", "illusttags"}}, {});
if (illust.ai_generated) {
@ -174,7 +174,9 @@ static inline Element generate_illust_tags(const Illust& illust) {
return i.japanese;
}();
div.nodes.push_back(Element("span", {"#", std::move(tag)}));
div.nodes.push_back(Element("a", {{"href", get_origin(req, config) + "/tags/" + blankie::murl::escape(i.japanese)}}, {
"#", std::move(tag)
}));
}
return div;