Giter VIP home page Giter VIP logo

kirby-blade's People

Contributors

beebmx avatar mittelgrau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kirby-blade's Issues

sitelinks opened with extenison .php return source code instead of 404

By installing this plugin, all sitelinks can be immediately accessed by appending the extension php and will return html source code instead of a 404 response. This affects plain php templates as well as blade templates and will probably cause serious SEO issues.

image

It can be simply reproduced by setting up the starterkit, add the extension an open url-to-starterkit/notes.php

As Kirby uses its own redirect magic through index.php, it seems that this issue can't be solved by simply adding .htaccess rule for php extension.

x-dynamic-component error

I get an error when trying to use <x-dynamic-component :component="$myComponent" class="mt-4" />:

image
]

The error above says "Unable to locate a class or view for component [{$component}]." even though I know the component exists because I can call it directly using the standard <x-[componentName]... /> syntax. I'm not sure. Any idea?

Note: I'm new to using Laravel Blade. Perhaps I'm not understanding something or perhaps there's an issue with using dynamic components.

Generating JSON representation

I am trying to generate a JSON representation of my blog articles like so https://getkirby.com/docs/cookbook/templating/generating-json

/site/templates/blog.json.php

<?php

$data = $pages->find('blog')->children()->published()->flip();
$json = [];

foreach($data as $article) {

  $json[] = [
    'url'   => (string)$article->url(),
    'title' => (string)$article->title(),
    'text'  => (string)$article->text(),
    'date'  => (string)$article->date()
  ];

}

echo json_encode($json);

Accessing the url "/blog.json" i don´t get the JSON data, just my default.blade.php template with content-type set to 'application/json'.

How can i retrieve the JSON data of my blog articles?

Blade anonymous components don't work within snippets

If you try to call a component within a Kirby snippet, an Exception gets thrown.

Take this setup for example:

{{-- site/templates/components/alert.blade.php --}}
<div class="alert">
    Hello
</div>
{{-- site/snippets/header.blade.php --}}
<header>
    <x-alert/>
</header>
{{-- site/templates/default.blade.php --}}
<!doctype html>
<html>
    <head>
    </head>
    <body>
        @snippet('header')
    </body>
</html>

An exception gets thrown: Method Illuminate\View\View::__toString() must not throw an exception, caught InvalidArgumentException: Unable to locate a class or view for component [alert].


I thought maybe I could use Blade's @include directive instead as a workaround, so I moved the site/snippets/header.blade.php file to site/templates/snippets/header.blade.php and update default.blade.php accordingly.

{{-- site/templates/default.blade.php --}}
<!doctype html>
<html>
    <head>
    </head>
    <body>
        @include('snippets.header')
    </body>
</html>

Doesn't work either. I get a different Exception: Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: Call to a member function get() on array (View: D:\Dev\www\example\staging\site\templates\snippets\header.blade.php) (View: D:\Dev\www\example.com\staging\site\templates\snippets\header.blade.php) (View: D:\Dev\www\example.com\staging\site\templates\snippets\header.blade.php)

Directives: Do they work?

I wasn't able to make any of the directives Work.

Looking at the:

It seems that directives by default don't parse the $parameters, you have to do it yourself. In these cases the correct version of the e.g. gist directive would be:

  'gist' => function($expression) {
     return "<?= gist($expression) ?>";
  }

Basically, just passing the expression in the Blade Templates through.

Am I wrong?

Yesterdays update breaks site after composer update

After updating yesterday, via composer, the Blade plugin causes this warning:

Warning: require_once(public/site/plugins/kirby-blade/vendor/autoload.php): failed to open stream: No such file or directory in /public/site/plugins/kirby-blade/index.php on line 3

Fatal error: require_once(): Failed opening required 'public/site/plugins/kirby-blade/vendor/autoload.php' (include_path='.:/usr/local/Cellar/[email protected]/7.2.13/share/[email protected]/pear') in public/site/plugins/kirby-blade/index.php on line 3

I think the Kirby composer installer also got updated yesterday.

I have the following installed...

        "php": ">=7.1.0",
        "getkirby/cms": "3.0.1",
        "omz13/kirby3-suncyclepages": "^1.0",
        "timoetting/kirby-builder": "^2.0",
        "sylvainjule/locator": "^1.0",
        "mzur/kirby-uniform": "^4.0",
        "flokosiol/focus": "^3.0",
        "sylvainjule/autofocus": "^1.0",
        "bnomei/kirby3-autoid": "^1.2",
        "bnomei/kirby3-mobile-detect": "^1.2",
        "bnomei/kirby3-srcset": "^1.2",
        "bnomei/kirby3-fingerprint": "^2.2",
        "k-community/markdown-field": "^1.0",
        "bnomei/kirby3-robots-txt": "^1.1",
        "omz13/kirby3-xmlsitemap": "@dev",
        "beebmx/kirby-blade": "^1.0",
        "sylvainjule/imageboxes": "^1.0",
        "sylvainjule/imageradio": "^1.0",
        "dg/twitter-php": "^3.7"

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.