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

Add dynamic Open Graph image generation for blog posts #22

Merged
merged 65 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
7f3d3db
Add dynamic OG images generator to blog posts
conradolandia Sep 27, 2024
1b1fa5c
Removed unwanted folder from commit
conradolandia Sep 27, 2024
ce0598c
Updated .gitignore to avoid the OpenGraph images folder
conradolandia Sep 27, 2024
d94d9ab
Add missing trailing space
conradolandia Sep 27, 2024
9ba26d1
Try an edit to the install.sh command to fix a segmentation fault
conradolandia Sep 27, 2024
9953e81
Revert last change since it had no effect in the remote build
conradolandia Sep 28, 2024
e1353e5
Updated some npm packages to try and solve the segmentation fault
conradolandia Sep 28, 2024
7c6daed
More changes trying to fix the segmentation fault
conradolandia Sep 28, 2024
34e8e39
A desperate, irrational attempt to some this issue
conradolandia Sep 28, 2024
757addf
Trying more stuff
conradolandia Sep 28, 2024
7a6741a
Change some versions of packages to see if this has any effect
conradolandia Sep 28, 2024
9f6e780
Try updating the node version
conradolandia Sep 28, 2024
ebc0895
Try a different canvas version
conradolandia Sep 28, 2024
e876520
Try to build from source the node dependencies
conradolandia Sep 28, 2024
ad74ee9
Try installing missing build dependencies from yaml.build
conradolandia Sep 28, 2024
e200f55
Restore old settings since changes had no effect
conradolandia Sep 28, 2024
bef84f5
Try installing node-canvas dependencies on ubuntu from the `install.s…
conradolandia Oct 1, 2024
8f23769
Try with the "stable" version of canvas, and using sabe config in `in…
conradolandia Oct 1, 2024
bf7f2c6
Try again building from source. If this does not work, I will find a …
conradolandia Oct 1, 2024
814977b
Try a different approach with sharp instead of canvas
conradolandia Oct 1, 2024
8c3aeaa
Try prerender = true
conradolandia Oct 1, 2024
546b397
Still not working properly but getting there
conradolandia Oct 2, 2024
ce62481
Testing the new OG image generator system
conradolandia Oct 3, 2024
5abf196
Add a test to see if the font it's installed
conradolandia Oct 3, 2024
084dd84
Try to get back to the old version of hooks.server.js to check if thi…
conradolandia Oct 3, 2024
2418053
Restore hooks.server.js
conradolandia Oct 3, 2024
4381cb5
Try copying the fonts with sudo
conradolandia Oct 3, 2024
16cbdc1
Try moving the action from the build file to the ci install file
conradolandia Oct 3, 2024
3d14164
Try to fix the default font weight
conradolandia Oct 3, 2024
7def01f
Copy only the needed fonts
conradolandia Oct 3, 2024
3b7909b
Change weight to regular to see if this affects anything
conradolandia Oct 3, 2024
35583ff
Try the default again with only 2 fonts installed
conradolandia Oct 3, 2024
32333d8
Try different CSS settings to see if I can catch the right font
conradolandia Oct 3, 2024
6cb8c69
Fix wrong font name from last time
conradolandia Oct 3, 2024
05b6415
Try a different setting. If this one does not work I will try a diffe…
conradolandia Oct 3, 2024
d051d37
Just fix the format in a way that works consistently, will take care …
conradolandia Oct 3, 2024
2c47f07
Try a local absolute path for the OG image, to see what happens
conradolandia Oct 3, 2024
4694fa7
Make final adjustements to styling and the resolution of the OG image…
conradolandia Oct 3, 2024
a1500e4
Fix a mistake with paths
conradolandia Oct 3, 2024
794b2e8
Fix a mistake in the metadata
conradolandia Oct 3, 2024
38a41ad
Add some debugin messages to trace where I can get the URL
conradolandia Oct 3, 2024
d69f5e9
Add some debugging messages to trace where I can get the URL
conradolandia Oct 3, 2024
08d6e10
Merge branch 'og-dynamic-images' of https://github.com/conradolandia/…
conradolandia Oct 3, 2024
732f54c
Try to use $page.url.origin to see if this woks at build time
conradolandia Oct 3, 2024
78d6790
Revert to the siteUrl value for now, it works better
conradolandia Oct 4, 2024
64d1869
Improve header visualization in blog posts to make it more consistent
conradolandia Oct 4, 2024
a549379
Try new font configuration
conradolandia Oct 4, 2024
42047b5
Try again with different settings
conradolandia Oct 4, 2024
f1072ef
Try a setting to see how the GH virtual machine names fonts
conradolandia Oct 4, 2024
b569f35
Try to use a different font copying scheme
conradolandia Oct 4, 2024
4845399
Try embeeding the font in the SVG
conradolandia Oct 4, 2024
ba02cc4
Try using the desktop version of the font
conradolandia Oct 4, 2024
d3609ec
Test enviroment variables to get the right domain
conradolandia Oct 4, 2024
96ca28a
Test a litle bit more to find environment variables
conradolandia Oct 4, 2024
737c3d8
Expand install script to export environment variables and save them t…
conradolandia Oct 5, 2024
f00f7b0
Fix a rookie mistake
conradolandia Oct 5, 2024
01cecd2
Simplify and improve the expression that sets the site URL
conradolandia Oct 5, 2024
7add5ae
Clean up a little bit (we dont need the variable in the shell)
conradolandia Oct 5, 2024
b925cea
Add error checking for more than 100 characters in the posts titles a…
conradolandia Oct 7, 2024
bb569b1
Remove some debugging which may be causing errors in the server
conradolandia Oct 7, 2024
6ce7f7e
Restore hooks.server.js to its former state, seems the current one is…
conradolandia Oct 7, 2024
9560fdf
Try a new setting in the install script to check an environment variable
conradolandia Oct 7, 2024
d7edcf4
Simplify check for environment variables in the install script
conradolandia Oct 7, 2024
2be25ed
Fix a mistake in a comment
conradolandia Oct 7, 2024
a6450a0
Remove some unneded meta tags
conradolandia Oct 7, 2024
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
6 changes: 4 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install dependencies
node-version: '22.x'
- name: Install dependencies and set environment variables
env:
NODE_ENV: ${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name == 'push' && 'production' }}
shell: bash
run: ./ci/install.sh
- name: Build site
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,6 @@ dist

# Svelte-kit files
.svelte-kit

# Generated OG images
static/assets/og
22 changes: 22 additions & 0 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
#!/bin/bash -ex

# Install project dependencies
npm install

# Install fonts for OpenGraph image creation
mkdir -p ~/.fonts/silka
cp -r static/assets/fonts/silka/desktop/* ~/.fonts/silka/
fc-cache -fv

# Determine if REVIEW_ID is set to select the URL to export
if [ -n "$REVIEW_ID" ]; then
# Staging URL (Deploy Preview)
SITE_URL="https://deploy-preview-${REVIEW_ID}--spyder-svelte-website-preview.netlify.app/"
else
# Default to production URL if REVIEW_ID is empty or false
SITE_URL="https://www.spyder-ide.org/"
fi

export PUBLIC_SITE_URL=$SITE_URL

# Create a .env file for Vite
cat <<EOF > .env
PUBLIC_SITE_URL=${SITE_URL}
EOF
Loading