Coder Social home page Coder Social logo

Comments (7)

dkemens avatar dkemens commented on August 30, 2024 1

Update

@include($page->getRelativePath() . "/_links") works just fine. The GenerateSitemap listener was failing and my docker image wasn't dropping the errors for some reason. Thank you for your time on this - doesn't seem to be an issue with Jigsaw at all - rather something between my configuration and the Sitemap system. For now, I've just disabled the generator. When I get back to it, I'll update this thread with whatever issue I find.

Thanks again!

from jigsaw.

bakerkretzmar avatar bakerkretzmar commented on August 30, 2024

What exactly do $page->headerLinks() and $page->getRelativePath() . '/_links' output? If @include('docs/platform/_links') works the only thing I can think of here is that the dynamic path generation isn't actually generating that exact path.

from jigsaw.

dkemens avatar dkemens commented on August 30, 2024

If I echo the output of either $page->headerLinks() or $page->getRelativePath() . '/_links' - in both scenarios, the output is docs/platform/_links - I can copy the echoed output and replace the @include value with that echoed output and it works as expected - but putting any variable in the @include doesn't do anything. In fact, I'd have to confirm this, but I think it prevents the page from building at all.

from jigsaw.

bakerkretzmar avatar bakerkretzmar commented on August 30, 2024

Can you try assigning the value to a variable and passing it in? Could be something weird happening with parentheses inside the @include().

E.g.:

@php
    $path = $page->getRelativePath() . '/_links';
@endphp
@include($path)

from jigsaw.

dkemens avatar dkemens commented on August 30, 2024

Yep. Tried that. Same exact result. In fact, even if I just do

@php
$headerLinks = 'docs/platform/_links';
@endphp
@include($headerLinks)

It still fails - doesn't even build the page. I get the ✔ Mix: Compiled successfully but the page didn't compile (I know this by adding extra text, like asdf on a different line and it not showing up).

from jigsaw.

bakerkretzmar avatar bakerkretzmar commented on August 30, 2024

Oh interesting, okay. This could be a limitation of Blade then, it looks like @include() needs a string literal and can't handle any kind of expression. Or it could be something weird we're doing. Do either of these work?

@include({{ $page->getRelativePath() . '/_links' }})
@include('{{ $page->getRelativePath() . '/_links' }}')

from jigsaw.

dkemens avatar dkemens commented on August 30, 2024

They do not (tried swapping various quote patterns on the second option, as well). I even just tried passing 'links' back from my markdown - the variable makes it back but it seems to just refuse to include any means of it.

my_content.md

---
extends: _layouts.master
section: content
title: My Title
links: docs/platform/_links
---

_layouts.master

@include($page->links)
@include({{$page->links}})
@include('{{$page->links}}')

This page gives me hope that it's possible in newer versions - https://laracasts.com/discuss/channels/general-discussion/blade-include-variable-in-include-function - but I'm not sure of the disconnect between Jigsaw's implementation and Laravel's. I'll keep fighting with it, maybe go the full debug route (was avoiding that in general for the sake of "simplicity"), see if I can find the culprit.

from jigsaw.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.