Closed lovethebomb closed 4 years ago
Good eyes! I just caught this myself. Added the VERCEL_URL
in Vercel but also in config.toml
. Still not working correctly. It isn't pulling the contributors in the footer anymore. Still debugging.
Seems like the contributors issues was not related.
Actually... it was! I hardcoded the links for now.
After testing different solutions in Vercel, I got it working!
Reminder: when using hugo serve
locally, hugo will automatically override the base URL for you (and thus this is also why it wasn't working for me as I thought it would).
In config.toml
we define
baseurl = "https://design.oxide.computer/"
This allows a 'safe' fallback when building for production with a simple hugo
command.
In Vercel, update the build command to be hugo -b https://$VERCEL_URL
And then enable the system environment variable VERCEL_URL
(both production
and preview
)
If the meta twitter:image
and Time Travel href button are changed to use {{ .Site.BaseURL }}
, it will correctly output the deployment URL! :)
<meta name="twitter:image" content="{{ .Site.BaseURL }}/images/logo.jpg">
<a class="history__exit" href="{{ .Site.BaseURL }}" title="Exit to main page">
=>
<meta name="twitter:image" content="https://design-site-1o7jf0m5d.now.sh/images/logo.jpg">
<a class="history__exit" href="https://design-site-1o7jf0m5d.now.sh" title="Exit to main page">
This is close but not quite working yet. Something about changing the build command is messing with the call to the GitHub API to grab the contributors.
That is odd!
If you look at my own deployed version based on the same changes, it seems to build with working contributors, even if the getJSON
API call is using the old repository name (GitHub handles the redirection but repos/oxidecomputer/design.oxide.computer
should be repos/oxidecomputer/design-site
)!
Could you either share the build
command used or the build logs, unless it contains sensitive data?
I just tried again. It is really strange that the contribs are showing up on your deployed version but not this one. I updated the build command updated the meta twitter:image
and Time Travel href button with {{ .Site.BaseURL }}
.
I was talking with @jessfraz about this and it is possible that the IP is getting rate-limited and that is why I'm not seeing the contributors...
Also, one problem with using VERCEL_URL
is that it resolves to Vercel's URL instead of our pretty URL...
Ah indeed! It would make sense!
This issue is not relevant anymore after the new GitHub actions and last commits on master
.
Thank you for your help @plainspace & @jessfraz. Closing the issue! :)
It seems that hugo doesn't use a base URL when building, which prevents the
twitter:image
and Time Travel exit button from working, following my changes introduced in e928f0e745008bada7f869a30073ec1c2372063b.We could rollback that change and hardcode the twitter image, or, we could use
VERCEL_URL
env var at build!I do not know what it is the build command used on Vercel right now, but a simple
hugo -b $VERCEL_URL
should do it.