Skip to content

Commit ee1a4be

Browse files
author
Lucas Magnum
committed
Atualização da doc.
1 parent bb6406e commit ee1a4be

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
1-
Random Articles Plugin For Pelican
1+
Json Articles Plugin For Pelican
22
========================
33

44
This plugin insert a variable called `json_articles` in the page context.
5-
Only published articles are listed.
5+
6+
This variable contains all articles in a json format.
7+
8+
9+
In settings we can define the number of random_articles:
10+
11+
RANDOM_ARTICLES = 3
612

713

814
Usage
915
-----
1016

11-
You can access all articles calling `json_articles` variable in your template.
17+
Add `dynamic_random_articles.js` in your template, in our case, just do that:
18+
<script src="{{ SITEURL }}/theme/js/dynamic_random_articles.js"></script>
19+
20+
In our sidebar.html was inserted:
21+
22+
div class="section articles-random">
23+
<h1 class="tagline">Não deixe de ver!</h1>
24+
<div id="random-articles"></div>
25+
</div>
26+
27+
We use `articles-random` class to hide it in mobile.
28+
29+
And then, we call the javascript function that render articles:
30+
31+
$(function(){
32+
show_random_articles($('#random-articles'), {{ json_articles }}, {{ RANDOM_ARTICLES }});
33+
});
34+
35+
Note that we pass a element to function, this element can be changed any time.

theme/templates/base.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
});
8383

8484
$(function(){
85-
articles = {{ json_articles }};
8685
show_random_articles($('#random-articles'), {{ json_articles }}, {{ RANDOM_ARTICLES }});
8786
});
8887

0 commit comments

Comments
 (0)