Greenheart/greenheart.github.io

Personal website

★ 1Forks 0SvelteGitHub ↗Compare

Project website ↗

README

greenheart.github.io

Personal website and tech blog

Building the site with talks included

NOTE: This could be simplified in the future to allow fully automatic builds.

  1. Git clone the talks repo https://github.com/Greenheart/talks
  2. To build all talks, go to the root directory of the talks project and run pnpm i && pnpm build. To build a specific talk, use the build command specific for that talk, and copy it over to the website repo.
  3. In the website project, run pnpm build to build project with all talks.
  4. Review the build output and remove unwanted HTML, CSS and JS. Replace favicon CDN imports. Replace font URLs to use the local fonts served together with this project.
  5. Verify everything works as expected and deploy.

Email spam protection

  1. Make a copy of .env.example and name it .env.
  2. Add your email to VITE_EMAIL in .env.
  3. Add a strong password to encrypt/decrypt your email to VITE_PASSWORD in .env.
  4. Open a terminal and run pnpm encrypt:text. Then copy the output (make sure you get every character) and add it to VITE_PAYLOAD in .env.
  5. Now, the email should be accessible in the <EncryptedEmail /> component. Easily available for users, but most basic spambots will not be able to extract the email.

Writing best practices

  • Use node scripts/title-case.ts to format headings.
  • Use node scripts/format-code.ts to ensure code has a consistent style.
  • Add <!-- prettier-ignore-start --> and <!-- prettier-ignore-end --> to wrap code blocks in blog posts to prevent the main Prettier instance of the codebase to re-format the code blocks after they already have been formatted with node scripts/format-code.js.
  • It's possible to prevent post drafts from rendering by prefixing the file with _.

Keeping local draft posts in the project without checking them in to Git

To avoid checking in draft posts that start with the _ prefix, append the following ignore pattern to .git/info/exclude:

echo "src/content/posts/_*" >> .git/info/exclude

This will include the draft posts during local development, but instruct Git to ignore these filenames starting with _.

To publish a draft post, just rename the file and remove the _ prefix. Then both the production build will include the file, and Git will let make it available to stage and commit.

Note that this might exclude these files from project search results, so you might need to explicitly include search locations like src/**/* to get the results you want.

Also note that .git/info/exclude only applies to the local Git repository and needs to be added for newly clones repositories. The reason for using this approach instead of .gitignore is because this allows some tools (like for example Keystatic CMS) to include the file, while still instructing Git to ignore the file.

License

Copyright (c) 2015-2025 Samuel Plumppu

Source code licensed under Apache 2.0.

Contributors

Greenheartdependabot[bot]

Issues