Connect CMS to EMBED code

Why my code is not working? Trying to get CMS data depending if we are in CMS page or not.

  document.addEventListener("DOMContentLoaded", function() {
  	console.log("Aktualna ścieżka URL:", window.location.pathname);

    var mainColor;
    var liteColor;

    if (window.location.pathname.includes('/kandydat/')) {
    	console.log("Jesteś na podstronie kandydata.");
      var nazwaKandydata = '{{wf { "path": "name", "type": "PlainText" } }}';
      console.log("Nazwa kandydata:", nazwaKandydata);
      var nazwaPartii = '{{wf { "path": "", "type": "PlainText" } }}';
      console.log("Partia kandydata:", nazwaPartii);
      mainColor = '{{wf { "path": "partia.kolor-glowny", "type": "Color" } }}';
      liteColor = '{{wf { "path": "partia.kolor-glowny-jasny", "type": "Color" } }}';
    } else if (window.location.pathname === '/') {
      mainColor = 'red';
      liteColor = 'grey';


  1. Aktualna ścieżka URL: /kandydat/kandydat-bezpartyjni
    Jesteś na podstronie kandydata.
    Nazwa kandydata:
    Partia kandydata:

Here is my public share link: LINK
(how to access public share link)

Hi Remigiusz,

You have Webflow field embeds in your code which only work on a collection page or inside of a collection list that is bound to a suitable CMS collection.

These are processed server-side to embed the data from the CMS. When you copy and paste them outside of a CMS binding context, you just have Webflow markup which are these strings-

'{{wf { "path": "name", "type": "PlainText" } }}'

What are you trying to do?