Site config support

Site config support

Summary

  • Situation: All user sites share the same, default datahub.io's nav bar and footer
  • Problem: As a user, I want to be able to change the title and the logo in the nav bar, customise the links in the navbar/footer, add site description for SEO etc.
  • Solution: config.json file included in the user's repo saved on the Site (Project) in the db
  • Appetite: 1d

Situation

All user sites share the same, default datahub.io's nav bar and footer. The only thing the user has control over is the markdown content itself (and high-level stuff like site name/domain)

Problem

As a user, I want to be able to change the title and the logo in the nav bar, customise the links in the navbar/footer, add site description for SEO etc. I don't want people visiting my site see datahub.io's logo/title and navigation.

Appetite

1d

Solution

config.json file included in the user's repo saved on the Site (Project) in the db:

Site {
  id: string;
  projectName: string;
  customDomain: string;
  ...
  config: json;
}

With the following config fields borrowed from Flowershow config:

SiteConfig {
  title?: string; // SEO title and default navbar title
  description?: string; // SEO description
  author?: string; // not sure if needed; originally was displayed as "Made by X" in the footer
  logo?: string;
  navbarTitle?: {  // more specific nav title config
    logo?: string;
    text?: string;
  },
}

Note: if you're publishing from a subdirectory of your repo the config file should be placed in that subdirectory.

Saving config to the db: The config file will be saved to the db at site creation and updated at subsequent site syncs.

Rendering site pages using site config: Just read the config from the db where it's needed, e.g. in the layout component to pass title, logo etc down to the nav bar or other components.

Rabbit holes

  • json or yaml I'd go with JSON

No goes

  • exposing the config file in the UI and making it editable there maybe in the future
  • do we want to allow for changing nav links and footer links atm or should it be enabled in paid plan in the future only? let's maybe only allow for changing the nav title, logo and SEO title/descirption for now; especially that we might actually get rid of top nav bar for user sites and replace it with Obsidian-like LHS navigation panel which will probably be auto-populated anyway

© 2024 All rights reservedBuilt with Find, Share and Publish Quality Data with Datahub

Built with Find, Share and Publish Quality Data with DatahubFind, Share and Publish Quality Data with Datahub