0
Welcome Guest! Login
0 items Join Now

SOLVED Trouble with stream links/paths?

  • SOLVED Trouble with stream links/paths?

    Posted 4 years 10 months ago
    • Server Details (Linux/Windows, Hosting service, etc)DreamHost shared host
      PHP version7.1.22 FastCGI
      Platform (name and version)Joomla! 3.9.6
      FrameworkGantry 5.4.28
      Template/Extension (name and version)Xenon 1.3.6
      Misc.Site is only accessible over https

      We encountered some trouble loading a JS file using the Page Settings method, as described in Gantry 5 docs, Advanced Theme Customization . We added the directory site-root/templates/rt_xenon/custom/js and uploaded a file, hello-world.js, to the new directory. For the Outline in question, in Page Settings > Before </Body>, we added the snippet:
      <script type="text/javascript" src="{{ url('gantry-theme://custom/js/hello-world.js') }}"></script>

      When loading/reloading a page/item that is assigned the Outline, instead of the expected console.log output, we see
      We've tried saving Page Settings with and without Body Classes (gantry) selected. This made no difference.

      %7B, %20, and %7D are percent encoding for left brace, space and right brace, respectively. We tried changing the snippet to:
      <script type="text/javascript" src="url('gantry-theme://custom/js/hello-world.js')"></script>

      After saving the Outline and reloading the test page, we see
      GET https://www.example.com/url('gantry-theme://custom/js/hello-world.js') 404 (Not Found)

      If we change the snippet to:
      <script type="text/javascript" src="gantry-theme://custom/js/hello-world.js"></script>

      save the Outline and reload the page, we see
      Mixed Content: The page at ' www.example.com/item-alias ' was loaded over HTTPS, but requested an insecure script 'gantry-theme://custom/js/hello-world.js'. This request has been blocked; the content must be served over HTTPS.

      If we change the snippet to:
      <script type="text/javascript" src="/templates/rt_xenon/custom/js/hello-world.js"></script>

      or
      <script type="text/javascript" src="https://www.example.com/templates/rt_xenon/custom/js/hello-world.js"></script>

      save the Outline and reload the page, we see the expected console.log output.

      Any ideas why stream path/link URLs (e.g. gantry-theme://...) as shown in the documentation don't seem to work for us?
    • Last Edit: 4 years 10 months ago by Ronald Nissley.
    • Politicians should dress like NASCAR drivers so we can identify their corporate sponsors.
  • Re: SOLVED Trouble with stream links/paths?

    Posted 4 years 10 months ago
    • Please create a Secure post with a link to your site with login details so we can take a direct look at your setup.
    • Last Edit: 4 years 10 months ago by Reggie Simmons.
    • Kind regards,
      Reggie

      Learn to code for free.
      www.freecodecamp.org
  • Re: SOLVED Trouble with stream links/paths?

    Posted 4 years 10 months ago
    • Reggie Simmons wrote:
      Please create a Secure post with a link to your site with login details so we can take a direct look at your setup.

      Here you go. Thank you!
    • Last Edit: 4 years 10 months ago by Ronald Nissley.
    • Politicians should dress like NASCAR drivers so we can identify their corporate sponsors.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13481
    • Web Designer/Developer

    Re: SOLVED Trouble with stream links/paths?

    Posted 4 years 10 months ago
    • I was trying to have a look for you but it seems that you have blacklist the UK as I get "The webmaster has forbidden your access to this site".

      I don't think "gantry-theme://" symbolic opr the fact that you used TWIG will be expanded from page settings so change the script to:
      <script type="text/javascript" src="/templates/rt_xenon/custom/js/hello-world.js"></script>

      Regards, Mark.
    • Last Edit: 4 years 10 months ago by Reggie Simmons. Reason: removed ') from end of script path
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.
  • Re: SOLVED Trouble with stream links/paths?

    Posted 4 years 10 months ago
    • I added it via Atom (also via Page Settings):

      This image is hidden for guests.
      Please log in or register to see it.


      You can then select the file and apply it before </body>:

      This image is hidden for guests.
      Please log in or register to see it.
    • The following users have thanked you: MrT

    • Kind regards,
      Reggie

      Learn to code for free.
      www.freecodecamp.org
  • Re: SOLVED Trouble with stream links/paths?

    Posted 4 years 10 months ago
    • Thank you, Reggie!

      It seems Gantry 5 docs - Advanced Theme Customization is slightly inaccurate or outdated or I'm not understanding something. Particularly the following from Three Methods:
      Gantry 5 docs wrote:
      ...The first method involves Atoms, powerful particles that add code to your pages site-wide...
      Another method involves the various fields of the Page Settings tab in your administrator. Like Atoms, these fields add scripting directly to your site, but they come with the added bonus of being able to be specifically assigned to specific outlines...

      Observing console.log output for a page that is assigned an Outline (and associated/assigned Atom) and a different page that is assigned a different Outline (no assigned Atoms), it appears Atoms are not global (site-wide) as the documentation suggests (adding code to pages site-wide). Also, Gantry stream links/paths (e.g. gantry-theme://) apparently don't work in the Before </body> field, as the Advanced Theme Customization doc indicates it would.
    • Politicians should dress like NASCAR drivers so we can identify their corporate sponsors.
  • Re: SOLVED Trouble with stream links/paths?

    Posted 4 years 10 months ago
    • Thank you pointing that out, I'll have to look into editing the documentation. Atoms can be assigned to specific outlines, just like Page Settings.

      The streams can't be used in the Before </body> section in the page settings.
    • Kind regards,
      Reggie

      Learn to code for free.
      www.freecodecamp.org
  • Re: SOLVED Trouble with stream links/paths?

    Posted 4 years 10 months ago

Time to create page: 0.048 seconds