Getting a post excerpt in DocPad - docpad

This is what I'm currently using to "grab" my posts: https://gist.github.com/Greduan/5977871
And then I do a for loop .toJSON() etc.
How can I make this grab an excerpt of the post and not all of the content? Cause I can just use #content but that'll output the entire post.
How can I make it have for example an excerpt with something like 500 characters then "..." and then a "Continue reading..." link or something along these lines.
I was thinking maybe using something like this:
#content.slice(0,500)
Or something like that. Would that work?
Thanks for your help. :)

Take a look at the answers here: Show only partial blog post in Docpad, with "Read More" link - they all involve some work, but the top one would probably do what you want.

Related

Magento Anchor Tags

I have a list of FAQ links on my home page in a static block in the footer. Each link however just opens up the FAQ page.
My code sample
What is Individually Quick Frozen?</li>
What I want is that when a user clicks a particular link in the list on the homepage footer under FAQs (as above), the user should be directly be taken to the answer of that question on the FAQ page i.e. the page should scroll down to where the questions is answered.
My Code sample
<p><strong><a id="1">What is Individually Quick Frozen?</a></strong></p>
But no joy! what am I doing wrong?
Make your link look like this:
What is Individually Quick Frozen?</li>
or better yet
What is Individually Quick Frozen?</li>
Note: For Cms pages urls use direct_url as a parameter for the {{store}} directive. It avoids having a / at the end of the URL. Useful if your pages end with .html. It's not your case but it may be useful in the future.
Now your code in the cms page should looks like this:
<p><strong><a id="_1">What is Individually Quick Frozen?</a></strong></p>
Avoid using numerical ids for elements. It's not standard
Worked perfectly, be sure to update
<a href="{{store url="faqs"}}#_1">
"faqs" to what ever page you want your tag to land on though.

Jekyll powered site - amount of text shown on homepage

I am setting my blog up using the fantastic Jekyll. Question is my markdown files are being shown in full on the homepage. How do i make them look more like this? So that only a little bit comes up with the title?
Thanks.
http://daverupert.com/
EDIT: As of Jekyll 1.0, this is not longer necessary (Answer is outdated).
Jekyll 1.0 exports a post.excerpt variable that contains the first paragraph of a post by default.
/Edit
So, you want to show an excerpt of the post, instead of the full post?
Theres three ways to do that:
Render the full post but use CSS to hide everything that is not needed
Use filters. You can access post.content, use the truncate filter to truncate it and the markdownify filter to render it.
Specify the excerpt in YAML Front Matter and render it using {{post.excerpt | markdownify}} (that is what i do on my blog)
Each of those blocks between horizontal lines are links to the actual blog post. Any time I have a question about how someone did something on their webpage I always view-source.
The source for that page is -
view-source:http://daverupert.com/
To find out how to do something in markdown I like this site -
http://daringfireball.net/projects/markdown/basics

jquery - can't select text on complex page - how do I debug this?

I'm not able to select text on a page that has a lot of jquery and css stuff going on. I've commented out many of the mousedown event handlers that seem like obvious culprits, but I still haven't found the bug.
The question is... what's the best way to debug this? Is there a better way to debug this than commenting out all event handlers until I find the problem? Is there some sort of event inspector I can use?
FYI, the page is:
http://www.musiclessons.com/youtube/#6NxVucKQHG8 - you can't select any text below the video
there it is:
$('#youtube-list').disableSelection ();
found in the following file, loaded by your page:
http://musiclessons.com/youtube/js/youtube.js?v=9
and here's what it's about:
http://forum.jquery.com/topic/disableselection
as for your question on an efficient way of debugging this: i don't really know. was looking through the css files for some 'user-select' property (see Is there a way to make text unselectable on an HTML page?), then read some of the js, before stumbling upon the above.
I am not sure why you need to select the text to debug, perhaps you can update the question with that.
For now, if you need to copy the text or something like that, you can always inspect with firebug or whatnot and select the text from there.

Link to a specific image/slide in gallerific

I'm having problems with something which seems like an easy task, and most probably a stupid question. It will probably be my all time low experience in programming but I would really appreciate any help!
I'm using Galleriffic to display my portfolio site, and I am looking for a way to directly link to an image+description not being the first in the gallery. I would like it to link from other webpages, or from plain text/pdf documents.
In short, I would like it to link to a webaddress of slide 5 with something like:
Slide 5
but doing it this way obviously doesn't work.
Although others have tried to explain:
https://stackoverflow.com/a/7910501/1074297
jquery cycle link from external page to specific slide?
I can not seem to accomplish it, and it does not help at all that I am not a programmer.
not sure if it is too late, have been search the solutions for whole day, final found out the example 4 in the official website actually make the #link show on the address....so you can actually link the specific image ('slide'') from external page...amazing!!!!!
check this out
http://www.twospy.com/galleriffic/example-4.html#5
You can find the script after all the or just before ... and place it to your template...it works well for me, hope it helps, good luck

Is there any way to easily link a file in RDoc?

I want to link to a documentation of a file in RDoc. but the only way I could do is with the following markup:
configuration.rb[link:files/configuration_rb.html]
I would like to do it in a better way, something like this:
<file>configuration.rb</file>
Is there any existing markup rule to do this?
EDIT: of course I've tried without any markup like this configuration.rb but it shows the filename without the link :(
To display a link in rdoc
{Link label}[url ]
Sample
{Killer question}[http://http://stackoverflow.com/questions/2230954/is-there-any-way-to-easily-link-a-file-in-rdoc]
will create a link of the this question
Auto hyperlinked: MyClass
my_class.rb def my_method; end;
#my_method http:, mailto:, ftp:, www. link: (to local filesystem relative to
--op) (urls to images are rendered as inline image tags) label[url] (uses
label as hyperlink text) {multi word
label}[url] (uses label as hyperlink
text)
Ruby:
ClassNames, source_files.rb and
either
method_name_having_an_underscore or
#methodnamewithhash are hyperlinked to their documentation.
It sounds like you're looking for that second one, but I've never used it before so I can't give you a fully useful example.
Try not to use markup at all.
Look at RDoc's own documentation, they have similar links in the "Roadmap" paragraph. They markup is here.
Magic!

Resources