Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posts snippets(Markdown) not converted before including in homepage(HTML) #43

Closed
rhl-bthr opened this issue Dec 29, 2017 · 11 comments
Closed
Labels

Comments

@rhl-bthr
Copy link

rhl-bthr commented Dec 29, 2017

Posts are written in markdown and their snippet is displayed on home takes it in html. Hence, the contents of the posts aren't properly displayed.
Eg: this post
On the homepage, this post looks a bit odd

This was referenced Dec 29, 2017
@sylhare
Copy link
Owner

sylhare commented Dec 30, 2017

Hi,

Are you talking about ``` in the post?
Do you have a screenshot showing what you want to achieve?

Thanks

@rhl-bthr
Copy link
Author

rhl-bthr commented Dec 30, 2017

Hi,
Yes ... as well and the rest of the code isn't formatted in the snippet of the post that's displayed on the homepage.
I have used marked.js to convert markdown to HTML.
i also tried

<section class="post-content">
                {{ post.content | truncate: "250" }}
</section>

in the homepage, but truncate:"250" is causing an issue. This code works fine without truncate:"250", but it returns the entire post.

@rhl-bthr
Copy link
Author

Could you guide me how to truncate the text ?
Thanks

@sylhare
Copy link
Owner

sylhare commented Dec 31, 2017

Hi,

On the homepage home.html, I used truncate: "250" to create an excerpt of the article (a little summary of 250 words). I added a strip_html to avoid any error.

For the highlight of code, you need to use the liquid tags:

{% highlight js %}

function foo() {}

{% endhighlight %}

For example I removed the ``` that were useless and now it looks like that:
image

But I still have trouble seeing what you wish to do.

@sylhare
Copy link
Owner

sylhare commented Jan 9, 2018

Hi @Pro-Panda what do you think of the actual? Is it what you wanted to achieve?

@rhl-bthr
Copy link
Author

rhl-bthr commented Jan 9, 2018

Hi @sylhare, I think I am unable to convey my issue properly.
Whatever content we write in markdown in the posts, a snippet of that is displayed on the homepage.
That snippet is rendered in HTML instead of markdown. Thats what I wanted to achieve in #45
Eg: See snippet of Feature Images Post here

@rhl-bthr
Copy link
Author

rhl-bthr commented Jan 9, 2018

I am using a quick hack by using a snippet variable and writing it along with post title and tags, in HTML.
See: http:https://pro-panda.tech

@sylhare
Copy link
Owner

sylhare commented Jan 9, 2018

Ok I think I know what you mean, do you have the markdown of the post in http:https://pro-panda.tech?

I have multiple request concerning the code layout, I would need to make some test.

@sylhare
Copy link
Owner

sylhare commented Jan 17, 2018

Well the problem is that I didn't want to get title on the excerpt (the small text in the home page). So I strip off all of the HTML and thus the markdown formating. However it is still rendered correctly in the post.

With that extent I wanted to achieve a more uniform home page (with title, image or not and normal text beneath.)
So to fix your problem, you would need to remove the strip_html in the liquid tag. I will see if I can come up with some kind of switch option that could let you display or not formatting (like code formatting) in the excerpt.

@rhl-bthr
Copy link
Author

rhl-bthr commented Jan 17, 2018

I have multiple request concerning the code layout, I would need to make some test.

Sorry, this message got skipped. Do you want the code ?

So to fix your problem, you would need to remove the strip_html in the liquid tag.

I tried removing strip_html, but it disturbed the indentation on the post text.

@sylhare
Copy link
Owner

sylhare commented Jan 17, 2018

Well I am ok now, it was to better understand your problem. I will look into how to deal with it.

@sylhare sylhare added the wontfix label Feb 3, 2018
@sylhare sylhare closed this as completed Feb 3, 2018
cdietrich pushed a commit to cdietrich/Type-on-Strap that referenced this issue May 8, 2020
…rmat's link" (sylhare#43)

When rendering the site an error occurs:

WARN 2019/07/02 12:11:16 Page's .RSSLink is deprecated and will be removed in a future release. Use the Output Format's link, e.g. something like:
    {{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}.

Related:
- gohugoio/hugo#4427
OMEGA-Y pushed a commit to OMEGA-Y/OMEGA-Y.github.io that referenced this issue Dec 8, 2020
* Remove unused directories

* Fix broken links

* Fix more links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants