Comments (4)
Hey @flxsource,
Sadly, entry title is something one can't rely on as it's dependant on the Content Type structure.
But if you want to cherry-pick an entry you can do it like follows:
{% for entry in site.data.contentful.spaces.my_space.entry %}
# By sys.id
{% if entry.sys.id == 'MY_ENTRY_ID' %}
# Do something...
{% endif %}
# By a property
{% if entry.title == 'some fancy title' %}
# Do something...
{% endif %}
{% endfor %}
All entries provide a key for it's ID accessed with object.sys.id
and you can easily filter by it, or you can filter by any property you want by directly accessing it.
Hope this helps
from jekyll-contentful-data-import.
I was hoping to avoid looping all of them, but it will certainly work.
Many thanks
from jekyll-contentful-data-import.
Sadly that's a limitation of the Liquid templating language, something like array.find { |object| object.sys.id == 'foo' }
would have solved it.
Glad it helped! 👍
from jekyll-contentful-data-import.
I've found another workaround for this issue, as long as the data structure you have in contentful supports it. I've built a proof of concept (that's also sufficient for my use case), and if you think it's worth while I'll do some more work to put it behind a config option and add some error handling.
See #11
from jekyll-contentful-data-import.
Related Issues (20)
- SSL Error HOT 1
- Sorting when iterating HOT 3
- Liquid syntax error when accessing data objects where ID starts with a number HOT 2
- Retrieving assets? HOT 6
- jekyll contentful data import issue HOT 1
- Locales missing in yaml file HOT 1
- environment variables HOT 3
- Documentation/Example: Jekyll collections HOT 1
- Cannot reduce resolution depth HOT 5
- Memory issues? HOT 5
- Update gemspec dependancy for rich_text_renderer HOT 1
- Localized Assets
- Unclear how to do rich_text_mappings
- Is it possible to use includes for rich-text content types? HOT 2
- No support for rich text data type? HOT 1
- Not importing drafts HOT 2
- Support for Jekyll 4.0.0 HOT 4
- Rich Text: Node Target Is Not An Asset HOT 4
- Support for importing entry snapshots
- Data strings that contain both : (colons) and ' (apostrophe) cause issues with data import
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jekyll-contentful-data-import.