ft-interactive / starter-kit

A template for IG pages
64 stars 15 forks source link

Fix <html> tag attributes #361

Closed pandringa closed 1 week ago

pandringa commented 3 weeks ago

When we migrated to the Vike v1.0 structure (#347), were were (previously) unable to set the <html> tag attributes that we had relied on in existing projects. In particular, this caused issues with:

More recent versions of vike-react have solved this problem by adding a new +htmlAttributes.js config file to set these attributes (even dynamically from the context data) — so this PR updates the various package versions and adds the appropriate files to take advantage of the new feature.

It might be that we eventually want to embark on a larger refactor of the config/ folder - right now we have effectively built our own config mechanism on top of the one that vike-react expects/supports. Still, for now this should provide a fairly effective fix to continue our existing config behaviour and make sure that pages work as expected.

Test steps:

  1. Set an arbitrary ID in the config/article.js file
  2. Run npm run build
  3. Run head -n 2 dist/client/index.html

The output should look like the following:

> head -n 2 dist/client/index.html
<!DOCTYPE html>
<html class="core" data-build-time="2024-08-19T16:39:59.378Z" data-content-id="test-uuid-value" lang="en">