Use custom URL if author starts with https:// #125

Merged
lunny merged 4 commits from jolheiser/theme:custom-url into main 2023-03-10 01:58:40 +00:00
Owner

Resolves #124 and would allow for something like author_domain: github.com if the author instead has a profile there.

Resolves #124 and would allow for something like `author_domain: github.com` if the author instead has a profile there.
jolheiser added 1 commit 2023-03-09 22:21:01 +00:00
feat: allow for author_domain in props
Signed-off-by: jolheiser <john.olheiser@gmail.com>
544e5da694
delvh reviewed 2023-03-09 22:32:50 +00:00
delvh left a comment
Owner

I guess the property is already offered by Hugo?

I guess the property is already offered by Hugo?
@ -21,3 +21,3 @@
{{- end }}
{{ else }}
<a class="author" href="https://gitea.com/{{ .Params.author | default .Site.Params.author }}">
<a class="author" href="https://{{ .Params.author_domain | default "gitea.com" }}/{{ .Params.author | default .Site.Params.author }}">

Please also adapt it in #18.

Please also adapt it in `#18`.
jolheiser marked this conversation as resolved
@ -24,3 +24,3 @@
{{- end }}
{{ else }}
<a class="author" href="https://gitea.com/{{ .Params.author | default .Site.Params.author }}">
<a class="author" href="https://{{ .Params.author_domain | default "gitea.com" }}/{{ .Params.author | default .Site.Params.author }}">

Please adapt it in #21 as well.

Please adapt it in `#21` as well.
jolheiser marked this conversation as resolved
Author
Owner

Which property? If you mean author_domain then no, it would be added as meta to a given post.

The reason I didn't adapt the multiple authors is because this new property would then apply to all of them. Maybe that's more correct, but I wasn't sure if it was worth it.

I can change it, though.

Which property? If you mean `author_domain` then no, it would be added as meta to a given post. The reason I didn't adapt the multiple `authors` is because this new property would then apply to all of them. Maybe that's more correct, but I wasn't sure if it was worth it. I can change it, though.
jolheiser added 1 commit 2023-03-09 22:38:18 +00:00
chore: apply param to multiple authors as well
Signed-off-by: jolheiser <john.olheiser@gmail.com>
57c764754b
Owner

Oh, then I misunderstood something drastically:
To me, it first looked like we could write something like author: https://github.com/test-user instead, and if it matched a URL, the URL would be taken instead of https://gitea.com/<user>

Oh, then I misunderstood something drastically: To me, it first looked like we could write something like `author: https://github.com/test-user` instead, and if it matched a URL, the URL would be taken instead of `https://gitea.com/<user>`
Author
Owner

That might be possible, let me tinker. I want to make sure we don't break any of the past posts.

That might be possible, let me tinker. I want to make sure we don't break any of the past posts.
Author
Owner

Ah, the problem with that is we need to be able to get both a URL and a human-friendly name from it, so we would then need to parse jolheiser from https://github.com/jolheiser

Ah, the problem with that is we need to be able to get both a URL and a human-friendly name from it, so we would then need to parse `jolheiser` from `https://github.com/jolheiser`
jolheiser added 1 commit 2023-03-09 22:56:16 +00:00
feat: infer from URL
Signed-off-by: jolheiser <john.olheiser@gmail.com>
7c33619e3f
Author
Owner

@delvh Okay, now it will try to infer based on whether the author starts with http

Unless someone has a username starting with http 👀

Although....honestly in 2023 I should just check for https:// and call it good. Who would have a profile on an http site anymore....right?

@delvh Okay, now it will try to infer based on whether the author starts with `http` Unless someone has a username starting with `http` :eyes: Although....honestly in 2023 I should just check for `https://` and call it good. Who would have a profile on an http site anymore....right?
jolheiser added 1 commit 2023-03-09 23:00:50 +00:00
chore: check for https:// prefix
Signed-off-by: jolheiser <john.olheiser@gmail.com>
15406ce8ac
delvh approved these changes 2023-03-09 23:15:02 +00:00
delvh left a comment
Owner

What I've just noticed:
We can even handle a username starting with https:// now, as we should simply use the full link to refer that person then…

What I've just noticed: We can even handle a username starting with `https://` now, as we should simply use the full link to refer that person then…
delvh changed title from Allow for author_domain in props to Use custom URL if author starts with `https://` 2023-03-09 23:15:57 +00:00
lunny approved these changes 2023-03-10 01:58:03 +00:00
lunny merged commit 5e7d82b6cd into main 2023-03-10 01:58:40 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.