Giter VIP home page Giter VIP logo

Comments (20)

shawnsandy avatar shawnsandy commented on September 28, 2024

You are correct -- the plugin just merges the custom values into meta array using the pico plugin file_meta() the get_pages() function grabs the original meta only, making the adv-meta values unavailable in the pages loop... I will look into a fix.

from adv-meta.

john-cheesman avatar john-cheesman commented on September 28, 2024

Would be great if you could get this working, I really want to use Pico but need access to custom values on the homepage

from adv-meta.

 avatar commented on September 28, 2024

I'm hoping there is a big update to the main repo of Pico with all of the suggested (& implemented) updates, or at least a fork that includes them.

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

Hopefully I get some time to look into this issue soon... I have been using a work-around (hack) for some time now here is what it looks like https://gist.github.com/shawnsandy/6282545, this might work for you until I can update the plugin or fork it which might be a good idea.

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

Updated the gist to include {{ page.type }} {{ page.slug }} and {{ page.category }}...

from adv-meta.

john-cheesman avatar john-cheesman commented on September 28, 2024

I'm using this fork that has custom fields built in and allows use as {{ page.type }} etc.

picocms/Pico#47

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

I really like his method get_pages() -- merged it into my pico.php file and kept my the read_file_meta() the same, using custom_meta_values set in the config... just not too comfortable with page creators being able to set the meta values...

from adv-meta.

 avatar commented on September 28, 2024

Are you referring to setting the meta values on the fly, on a per post/page
basis? You prefer to have the usable ones set in the config file?

If this is your 'concern' I can understand. I guess it really depends on if
the site has a single user or many.

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

It's more of a preference, if you think of it pages are created by the end-user who may or may not be web designers/developers -- meta values can really only be used by a developer/designer creating the theme, making it a design/development task. I just hate giving access to such task(s) to the end user no matter how harmless they may seem...

from adv-meta.

 avatar commented on September 28, 2024

Does v0.7 fix this? I still can't seem to access the custom variables in the loop ( {% for page in pages %} ) only on the single pages.

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

See commit -- a18b567

Yes v0.7 does fix these issues (thanks https://github.com/gilbitron) --- now the plugin just makes it easier to add and use custom meta values without the need to fork and change core files.

You cannot access {{ meta.value }} in page loops, meta.value are for single pages you can use {{ page.meta_value }} to access custom meta values in a page loop...

Hope this helps!

from adv-meta.

 avatar commented on September 28, 2024

I guess it's just me then. I've tried that to death, even with the stock core pico & adv-meta files using the example you provided in the readme and it won't work. The values appear on single pages with {{ meta.value }} but not in the loop with {{ page.meta_value }}.

No worries. I'm a newbie and will figure it out sooner or later.

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

It may not be you it could be an error in the plugin code, make sure you get the latest relase... can you post a gist of your code I will see if i can replicate the issue...

thanks!

https://github.com/shawnsandy/adv-meta/archive/master.zip

from adv-meta.

john-cheesman avatar john-cheesman commented on September 28, 2024

Hi, just had a go on a fresh install (at work) and it looks like {{ page.meta_value }} is returning the values for the current page for every page in the loop. I tried it on the navigation in the default template:

{% for page in pages %}
    <li><a href="{{ page.url }}">{{ page.title }} | {{ page.type }} | {{ page.slug }}</a></li>
{% endfor %}

which prints the 'type' and 'slug' from the page you're viewing into each menu item.

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

John, are you seeing the correct values???

from adv-meta.

john-cheesman avatar john-cheesman commented on September 28, 2024

I'm getting the correct values for the page I'm viewing, so on the homepage, where 'type: page' and 'slug: homepage', I get:

<li><a href="http://localhost/vhosts/pico/">Welcome | page | homepage</a></li>
<li><a href="http://localhost/vhosts/pico/sub/">Sub Page Index | page | homepage</a></li>
<li><a href="http://localhost/vhosts/pico/sub/page">Sub Page | page | homepage</a></li>

The other two pages have different values set which you can see by viewing them.

Thanks for your help btw

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

Hey John, there is still an issue there, what you should be seeing is the meta value of each page, download the latest commit that should fix it, please let me know if you are still having issues

Here is what it should look like :-

<aside>
<h1 class=""><a href="http://localhost/pico-master/pico">Welcome</a></h1>                            
 <p>Meta- Values : Type - page - Slug - home</p>
</aside>
<aside>
<h1 class=""><a href="http://localhost/pico-master/sample-page">Sample Page</a></h1>
<p>Meta- Values : Type - Blog - Slug - sample-page</p>
</aside>                                                                                                                                                                    

...

from adv-meta.

 avatar commented on September 28, 2024

The most recent commit fixed it for me.

Thanks for looking into this.

Cheers,

Kevin

from adv-meta.

shawnsandy avatar shawnsandy commented on September 28, 2024

Glad to hear it Kvanlierop.. NP...

from adv-meta.

john-cheesman avatar john-cheesman commented on September 28, 2024

Fixed, thanks alot

from adv-meta.

Related Issues (2)

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.