halogenica / beautifulhugo

Theme for the Hugo static website generator
Other
1.13k stars 602 forks source link

Implement more general Gitlab link. #447

Closed stafusa closed 1 year ago

stafusa commented 1 year ago

Closes #436

henryiii commented 1 year ago

Would it be possible to detect if the host was missing and include a default? This will break all existing websites linking to gitlab.

stafusa commented 1 year ago

Would it be possible to detect if the host was missing and include a default? This will break all existing websites linking to gitlab.

True, allowing different hosts is probably not important enough to break current configurations. At the same time I wouldn't want to make Gitlab a special case with dedicated HTML code and new variables.

What do you think of introducing "gitlab-alt", that takes "server/username" (like my current suggestion), and bringing back "gitlab" the way as it is in main, with gitlab.com implicit?

Edit: Do you think it's a good solution @henryiii ? I could implement it.

henryiii commented 1 year ago

I don't think that scales to other uses very well. GitHub also allows custom host URLs, so it would also be nice there. Where is this being consumed? I think we should first verify it's not easy just to detect a slash and add a default if it's not present.

Edit: as a more general solution, I'd say a full URL here ideally would render as a full URL. The final consumer is

https://github.com/halogenica/beautifulhugo/blob/4b5a7c7534c9acdb3e185adc6b23318c91c535dd/layouts/partials/footer.html#L12

So if that just checked to see if it started with https://, then used it directly, wouldn't that be a more general solution that would also work for GitHub and others?

stafusa commented 1 year ago

Edit: as a more general solution, I'd say a full URL here ideally would render as a full URL. The final consumer is

https://github.com/halogenica/beautifulhugo/blob/4b5a7c7534c9acdb3e185adc6b23318c91c535dd/layouts/partials/footer.html#L12

So if that just checked to see if it started with https://, then used it directly, wouldn't that be a more general solution that would also work for GitHub and others?

That's definitely a proper way of doing it @henryiii . Thanks for the pointer. Please check whether I got something wrong in my latest implementation. It tests for "http[s]://" as you suggested.

stafusa commented 1 year ago

LGTM! Will wait a day or so to see if any other maintainers have input, then will merge. (remind me if I forget!)

@henryiii Your friendly reminder. :)