Slot and Fill

Sorry, there’s no built-in way to do that. I guess that you could try create that yourself by creating the array of “slots” as you mentioned. Then you could map over it and for each slot return an object sth like:

const slots = ["slot-1", "slot2", "slot3"];
let mappedFills = {};

slots.forEach((slot, index) => {
  mappedFills.push({
    [`${slot}-${index}`]: {
      slot
      library: "namespace.ComponentName",
    }
  })
});

const state = {
  fills: {
    namespace: mappedFills
  },
};

Yup, it’s implemented. You can just set state.frontity.debug to true and it will show a “debug” fill in each slot. This is implemented in https://github.com/frontity/frontity/blob/49a863b37a5a6234588b020e409781fad68fd98a/packages/frontity/src/utils/slot-and-fill/use-fills.tsx#L70

2 Likes