There are different options here to define the new source.url
and I am not sure what is best:
- We can define it in the general settings, like
frontity.url
.
- We can define it in the source package, like the old
source.api
.
Both of them will work, but we should reach an agreement to see how we document and explain it.
If we take mars-theme as example, the initial frontity.settings.js would look like this:
1. Defining source.url in the general settings
const settings = {
name: "new-project",
state: {
frontity: {
url: "https://test.frontity.org",
title: "Test Frontity Blog",
description: "WordPress installation for Frontity development",
},
source: {
url: "https://test.frontity.org",
},
},
packages: [
{
name: "@frontity/mars-theme",
state: {
theme: {
menu: [
["Home", "/"],
["Nature", "/category/nature/"],
["Travel", "/category/travel/"],
["Japan", "/tag/japan/"],
["About Us", "/about-us/"],
],
featured: {
showOnList: false,
showOnPost: false,
},
},
},
},
"@frontity/wp-source",
"@frontity/tiny-router",
"@frontity/html2react",
],
};
export default settings;
The wp-source
package would come up with no configuration, and if users want to add some settings, like postTypes for example, they would need to change it from a string to an object, like the theme.
If we release new source packages like wpgraphql
in the future, users donāt have to change this setting.
2. Defining source.url in each source package
const settings = {
name: "redirects",
state: {
frontity: {
url: "https://test.frontity.org",
title: "Test Frontity Blog",
description: "WordPress installation for Frontity development",
},
},
packages: [
{
name: "@frontity/mars-theme",
state: {
theme: {
menu: [
["Home", "/"],
["Nature", "/category/nature/"],
["Travel", "/category/travel/"],
["Japan", "/tag/japan/"],
["About Us", "/about-us/"],
],
featured: {
showOnList: false,
showOnPost: false,
},
},
},
},
{
name: "@frontity/wp-source",
state: {
source: {
url: "https://test.frontity.org",
},
},
},
"@frontity/tiny-router",
"@frontity/html2react",
],
};
export default settings;
For new source packages, users would have to add this setting to this package, even though it is the same for all the source packages.
I personally donāt have a strong opinion here about which option is better.
@juanma @mburridge Which option do you think fits better in the learning journey you are working on? How would be easier to explain Frontity?