Posts module doesn't give path
Created 1 year ago by gonziis
{% for post in entries('posts', 'posts').orderBy('id','desc').take(3).get() %}
                        {{ post }}
                        <div class="article col-md-4">
                            <span class="date">{{ post.publish_at.format("d/m/Y") }}</span>
                            <h3 class="title">{{ post.title }}</h3>
                            <p>{{ str_limit(post.summary, 450)|raw}}</p>
                            <a href="{{ url(post.path) }}"><div class="button">{{ trans('')|raw }}</div></a>
                    {% endfor %}

post.path is empty, not even defined in the variable list of {{ post }}. Isn't here supposed to be a path variable to get direct link? Or am I supposed to make the link myself by using slug?

ryanthompson  —  1 year ago

Use {{ post.route('view') }}

gonziis  —  1 year ago

Ok thanks, though that posts.path should have worked because it was mentioned like that in a lot of examples. I have an additional quesiton, how can I edit the views of posts module? Should I somehow extract it as a custom module? Because I see that there is a custom HTML that gets interpreted as content , but I can't find anywhere in CMS to edit it.

ryanthompson  —  1 year ago

I'll have to update the examples - it should work (perhaps post.object.path?). But route is the best way to get these object paths (regardless of type - pages, posts, files, etc).

The content is built from your post type's layout HTML.

If you want to edit any of the addon's views then you can publish it like php artisan addon:publish posts and edit the view files as needed in your resources directory.

Here are some guides including one for views you can apply to your overriding needs!