question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal for namespaced theme-dependant configs

See original GitHub issue

This is a proposal for extending the config properties for themes package.json.

Why is this useful?

  • As a developer I can just declare the configs I want to use and then use them, leaving it to the user to configure them in the admin backend.
  • As a user I want to configure my theme instead of editing files, which is a bad approach in the first place as it defies maintainability and upgradeability (now I have to edit my files in the “uno-zen” theme in order to select and configure the social accounts I want to link)

Envisioned developer workflow

As a theme developer I want to be able to use central user configuration, i.e. for the social group. Currently there is a blog config for a facebook profile. As a developer instead of using @blog.facebook, I would like to use @config.social.facebook property. This by itself does not bring a lot of value, but bear with me for a moment. Say I also want to do something really nice like the uno-zen theme which allows for 37 different social icons. I could i.e. check a reddit account by checking the @config.social.reddit property.

configs in theme

How would ghost know about such a property? Well, it could be as simple as a list or object in the theme’s package.json. Think something like

{
  // ...
  "config": {
    "social": [
      "reddit", "stumbleupon", "github", "github_org", "google-plus"
    ]
  }
}

Note: A list would obviously be the easiest, an object could carry meta information about the config though (i18n tho …).

Notice the github_org config? This could be something that is just interesting to this theme: Imagine a blog for an open source project where they have a primary repo, but also a nice collection of other useful libraries. Or anything, matter of fact is there is no constraint on the number or names of the items, they will be represented as “Config for Stumbleupon”, “… Github”, “… Github Org”, “… Google Plus” (notice the conversion to title case).

Other configs

This approach can of course be extended to other configs, given that there is a config area (e.g. “Publication Info”). One useful other example would be including disqus comments or not, something which is commonly solved by editing files as well.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:16
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
ashleysommercommented, Oct 25, 2018

If we now allow defining any key in this config object, the Ghost team has no chance to add a new key, because it could be used from a theme developer already. IMO there needs to be a clear differentiation between theme developer specific/custom config and Ghost config properties.

That is why this proposal specifically calls for “namespaced configs”, that is, there will be no collisions of keys because each config set will exist in its own namespace under config.

3reactions
ashleysommercommented, Nov 23, 2019

This issue is the number one reason I abandoned Ghost back in January. Dev’s have no interest in implementing features which users and theme builders obviously want and need.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proposal for unified namespace organization - Drupal
Based on the dozen or so (it feels like) namespace organization threads floating around, I would like to offer the following over-arching ...
Read more >
Theme Configuration - Atlassian Developer
The themes can be configured via the Configuration link on the Choose Theme page on both the space and global level. For example,...
Read more >
NetSuite Applications Suite - Namespace View
Installing Theme and Extension SuiteApps ... Setting Up Script Deployments for Themes and Extensions ... Steps for Creating Dependent Dropdown Lists.
Read more >
verdaccio-theme-feui - npm Package Health Analysis - Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix ...
Read more >
[Proposal] Make "App" namespace configurable #93 - GitHub
The installation process creates a bin/console script which tries to use App\Kernel.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found