Comments (9)
Can you explain what the resolution was? I have having the same question....
from jekyll-help.
But that's not the issue I'm having. My current setup works for evaluating markdown in the include but it does not evaluate any of the liquid tags in the markdown which is what I want.
The markdownify filter just throws away all my liquid tags.
from jekyll-help.
Hi @duanefields,
I recently encountered a similar problem when I wanted to include projects which are independent jekyll pages on a summary page.
My ideas were
include_relative
(problem: one can't include pages with a YAML front matter)- picking the page from all pages (problem: liquid tags are not evaluated)
As I needed to get this working for github pages (=without plugins
), my workaround is a combination of both and looks horrible - I would be very happy if this gets fixed in a future release and there is an easier way to include a jekyll page in another jekyll page :)
Basically it loops over all pages, picks the one I want to include, uses their filePath to call include_relative
and then strips the YAML front matter.
{% for p in include.pages %}
{% if p.gsoc == include.gsocYear %}
{% capture inpath %}{{page.gsocYear}}/projects/{{ p.name }}{% endcapture %}
{% capture content %}{% include_relative {{inpath}} %}{% endcapture %}
<!-- probably the ugliest way to remove the YAML front matter -->
{% assign lines = content | newline_to_br | split: "<br />" %}
{% assign newContent = "" %}
{% for l in lines %}
{% if forloop.index >= 6 %}
{% assign newContent = newContent | append: l %}
{% endif %}
{% endfor %}
{{ newContent | markdownify }}
source: https://github.com/biojs/biojs.net/blob/gh-pages/gsoc/includes/ideas.md
page: http://biojs.net/gsoc/2015/
from jekyll-help.
Make sure you include {{ content }}
in your layout. That will output the converted and rendered version of any page which specifies it as its layout.
from jekyll-help.
Well, that's the issue, right?
I have an about.html file sitting in jekyll's root directory which itself has a layout _layouts/about_layout
I can include my about.md file in about.html but then when the layout evaluates it the liquid tags have been removed. I guess I don't understand how I should be structuring this to achieve my goal.
Right now I've got:
_includes/about.md being included in about.html (a page) whose layout is _layouts/about layout
from jekyll-help.
Front matter, in this case- "layout: ", in an included file, will not be parsed as you are supposing.
The main index file should possess the "layout: " specification, i.e.:
./about/index.html
---
title: About
layout: about
---
## How about this?
{% include some-about-include.include %}
./_layouts/about.html
---
layout: sub-layout-if-desired
---
<div class="about-class">
... {{ content }}
</div>
./_includes/some-about-include.include
{% for bout in site.about %}
{{ bout.title }}
{% endfor %}
## Some Markdown will work
- But you will need to filter through `mardownify`
- (of course)
from jekyll-help.
Do you wish for for the liquid code to be evaluated and produce output based on the evaluation?
Or, are you wishing for the liquid code
itself to be (re)produced and output/shown?
Perhaps restate your goal, from the top, succinctly.
Liquid within included files can be, and is, evaluated and produces evaluated output, as expected.
Example:
./_includes/posts.include
{% for post in site.posts %}
{{ post.title }}
{% endfor %}
./_layouts/default.html
<html>
<head>...</head>
<body>
{{ content }}
</body>
</html>
./about/index.html
---
title: "My About Page"
layout: default
---
## This is my About Page
- Here is a list of posts:
{% include posts.include %}
### Have a nice day
from jekyll-help.
An example repository would also be very helpful.
from jekyll-help.
Sorry for the lack of clarity.
I think I figured out what was going on. Thanks for the help and great examples!
from jekyll-help.
Related Issues (20)
- undefined method 'activate_bin_path' HOT 1
- files not able to be accessed HOT 1
- bundle problem HOT 1
- Bundler could not find compatible versions for gem “kramdown” HOT 1
- Jekyll Error not helpful HOT 1
- Every thing is perfect in local server. But not in GitHub. HOT 1
- favicon for minima theme HOT 1
- Installation Process NEED HELP HOT 1
- Jekyll Server Stripping URLs From Generated Code HOT 1
- Jekyll category names from folder name & frontmatter HOT 1
- cannot install HOT 1
- jniujhcv HOT 1
- Saving a file while running jekyll serve causes an error HOT 1
- GH-pages build and local jekyll build have different display formats for posts HOT 1
- Need Jekyll Help in running multiple jekyll instances on different port and using nginx server HOT 1
- Installation fails on CentOS 7 due to dependencies HOT 1
- Jekyll Build Not Working after MacOS High Sierra Update HOT 1
- Accessing specific data items not working HOT 1
- Jekyll not found after running gem install HOT 1
- GitHub published site appears much different than local site HOT 1
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-help.