jekyll-theme-paperwiki 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4fdedc32cb88321f3a4f385ebce2e51ff63a50f04a1d0bda529fca11039a519
4
- data.tar.gz: 666179a519fad2588b6c4fac26a9fa5434e7f4720efe5b2f953105d1e5d7c3b0
3
+ metadata.gz: bd5647356250d27a51862ad94ca40a17ba4ec33bec742b95d09a3dc38c0f3d9b
4
+ data.tar.gz: 817ac6d86315dac8b99e4e8c88f07ae5d5ecb0b4028f4fa70ca21127287ece04
5
5
  SHA512:
6
- metadata.gz: d8ee82260e046e1983299f4637de1bddb380c809ecced5a7462696ca78c085b3d6fdfe07c6c9ac60a3e759235c4869b1b30d6d41e2707448ad06452e0544170d
7
- data.tar.gz: 10faec06628838ef30f2cab51831f1397988a28e5bc9a35151f2cca1055c9a7e033e9442c7ee21a3f5b429969ed6a6b46140bc4a34e19f248cfd46b99a0dff5e
6
+ metadata.gz: c0ead5a13368865eca2b9c0d8c190dd563182b5b3ec085214b34230203583196e2fc2d2c4efe192cec12fb151ae75fba9a19977136c7eda1252de50b5664a163
7
+ data.tar.gz: 89ae3bfe1fc0eaf2ef2bf0991bb2eb0e74c44be1f9f8f1c9ae25fd0c08a0e4bf5759c581498e35528ea31d2124a27647071b6644288ce659b1d933b2dfb5cfca
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # jekyll-theme-paperwiki
2
2
 
3
- The intent of this theme is to get all the code out of the way and to allow you to write Markdown articles.
3
+ The intent of this theme is to get all the code out of the way and to allow you to write Markdown articles; the best way to do that is to install the theme as a gem. However, if you want to tinker with the code, just download this repository.
4
+
5
+ This theme is not mobile friendly, as I personally do absolutely no worldbuilding on mobile and thus my development skills are lacking. There is also no dark mode or other alternate colour scheme, but please feel free to fork this project and add whatever functionality it's missing.
4
6
 
5
7
 
6
8
 
@@ -21,14 +23,35 @@ This theme comes with all of these prepackaged, so most of what you have to do i
21
23
 
22
24
  [Install Jekyll](https://jekyllrb.com/docs/). Create a new site by running the following in your terminal:
23
25
 
24
- $ jekyll new MYSITENAME
26
+ ```
27
+ $ jekyll new MYSITENAME
28
+ ```
29
+
30
+ This will give you a very bare bones Jekyll site, with an index page, a folder for blog posts, a config file, and a Gemfile. You'll have to do a little setup to make it usable with this theme. Here's what the directory should look like:
31
+
32
+ ```
33
+ .
34
+ ├── _pages/
35
+ │ ├── wiki/ # In here is where your organizational pages for your wiki will go.
36
+ ├── _posts/ # If you want to write blog posts, they go in here.
37
+ ├── _site/
38
+ ├── collections/
39
+ │ ├── _wiki/ # In here is where all your articles will go, in markdown or html files.
40
+ ├── _config.yml
41
+ ├── 404.html
42
+ ├── about.md
43
+ ├── Gemfile
44
+ ├── index.md
45
+ ```
25
46
 
26
- This will give you a very bare bones Jekyll site, with an index page, a folder for blog posts, a config file, and a Gemfile. You will want to add a folder called `collections`, and inside of that another folder called `_wiki`.
47
+ (Don't worry about the .gitignore or the Gemfile.lock.)
48
+
49
+ (You can also move your `_posts` folder into your `collections` folder if you want; I find it makes things a little neater.)
27
50
 
28
51
  To use this theme, open your Jekyll site's `Gemfile`, delete the line that says `gem "minima"` and replace it with this line:
29
52
 
30
53
  ```ruby
31
- gem "jekyll-theme-paperwiki"
54
+ gem "jekyll-theme-paperwiki", "~> 0.1.2"
32
55
  ```
33
56
 
34
57
  And add this line to your Jekyll site's `_config.yml`:
@@ -49,7 +72,32 @@ Or install it yourself as:
49
72
  $ gem install jekyll-theme-paperwiki
50
73
  ```
51
74
 
75
+ To serve your site locally, navigate into the site's directory and run:
76
+
77
+ ```
78
+ $ bundle exec jekyll serve
79
+ ```
80
+
81
+ Navigate to your localhost and...you will see an empty page. This is because the layout in the default `index.md` is not set properly. Open this file and change the layout like so:
82
+
83
+ ```yaml
84
+ layout: launchpad
85
+ ```
86
+
87
+ This will show you the default wiki homepage. The three links - explore, contents, and random page - link to pages that are included with the theme, and consist of pregenerated content based on the wiki articles you've written. Now you can start adding articles in your `_wiki` folder.
88
+
89
+ ### Using the wiki
52
90
 
91
+ All of your wiki pages should be written in markdown, and you must begin each `.md` file like so:
92
+
93
+ ```
94
+ ---
95
+ ---
96
+ ```
97
+
98
+ Between these two lines is where you include *front matter*, such as specifying the layout or the permalink to the page. However, you can leave the front matter blank - wiki pages have layouts and permalinks set by default in the theme's config file, and you only need to specify them if you want to override the defaults. You also do not need to specify a title for the page, as it is automatically taken from the filename. All you absolutely need is the two triple-dashed lines, as Jekyll needs it to know that the front matter is there in order to output the page.
99
+
100
+
53
101
 
54
102
  ## Config
55
103
 
@@ -73,7 +121,7 @@ However, if you would like to have additional collections akin to the Wikimedia
73
121
  permalink: /:collection/:name
74
122
  ```
75
123
 
76
- Make sure to add the corresponding folders within `collections`, including the preceding underscore.
124
+ Make sure to add the corresponding folders within `collections`, including the preceding underscore: `_literature`, `_dictionary`, etc.
77
125
 
78
126
  Add into your `_config.yml`:
79
127
 
@@ -81,7 +129,18 @@ Add into your `_config.yml`:
81
129
  multi_projects: true
82
130
  ```
83
131
 
84
- This will add links to each different collection on your homepage, and allow you to limit the scope of your searches to a single collection or expand it to cover all of them at once.
132
+ You will also need to add a data file listing your projects: create a folder titled `_data` and inside it a file titled `projects.yml`. Within it you need to list the following, formatted in the same way:
133
+
134
+ ``` yaml
135
+ - name: Wiki
136
+ link: /wiki
137
+ icon: ri-global-line
138
+ desc: A brief description here
139
+ ```
140
+
141
+ For the icon, find one you like from RemixIcon and copy the code.
142
+
143
+ This will add links to each different collection on your homepage, and allow you to limit the scope of your searches to a single collection or expand it to cover all of them at once. You do not need to do anything to
85
144
 
86
145
 
87
146
 
@@ -100,6 +159,6 @@ The theme is available as open source under the terms of the [MIT License](https
100
159
 
101
160
  ## Credits
102
161
 
103
- This theme uses the fonts [Inter](https://rsms.me/inter/), [Libertinus Serif](https://github.com/alerque/libertinus), and [Liberation Mono](https://fontlibrary.org/en/font/liberation-mono), all of which are released under the SIL Open Font License; and the icon font [RemixIcon](https://remixicon.com/), which is available under the Apache License 2.0. The [example favicon](https://www.flaticon.com/free-icon/picture_4671171) is by Royyan Wijaya at Flaticon.
162
+ This theme uses the fonts [Inter](https://rsms.me/inter/), [Libertinus Serif](https://github.com/alerque/libertinus), and [Liberation Mono](https://fontlibrary.org/en/font/liberation-mono), all of which are released under the SIL Open Font License; and the icon font [RemixIcon](https://remixicon.com/), which is available under the Apache License 2.0. The [example favicon](https://www.flaticon.com/free-icon/toucan_3002355) is by Freepik at Flaticon.
104
163
 
105
164
  The search function uses [Lunr.js](https://lunrjs.com/).
data/_config.yml CHANGED
@@ -1,55 +1,15 @@
1
- # Welcome to Jekyll!
2
- #
3
- # This config file is meant for settings that affect your whole blog, values
4
- # which you are expected to set up once and rarely edit after that. If you find
5
- # yourself editing this file very often, consider using Jekyll's data files
6
- # feature for the data you need to update frequently.
7
- #
8
- # For technical reasons, this file is *NOT* reloaded automatically when you use
9
- # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10
- #
11
- # If you need help with YAML syntax, here are some quick references for you:
12
- # https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
13
- # https://learnxinyminutes.com/docs/yaml/
14
- #
15
- # Site settings
16
- # These are used to personalize your new site. If you look in the HTML files,
17
- # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
18
- # You can create any custom variable you would like, and they will be accessible
19
- # in the templates via {{ site.myvariable }}.
20
- title: Your Title Here
21
-
22
1
  # Build settings
23
- theme: jekyll-theme-paperwiki
24
2
  include: ['_pages'] # forces custom pages to be organized into their own directory
25
3
 
26
- # Exclude from processing.
27
- # The following items will not be processed, by default.
28
- # Any item listed under the `exclude:` key here will be automatically added to
29
- # the internal "default list".
30
- #
31
- # Excluded items can be processed by explicitly listing the directories or
32
- # their entries' file path in the `include:` list.
33
- #
34
- # exclude:
35
- # - .sass-cache/
36
- # - .jekyll-cache/
37
- # - gemfiles/
38
- # - Gemfile
39
- # - Gemfile.lock
40
- # - node_modules/
41
- # - vendor/bundle/
42
- # - vendor/cache/
43
- # - vendor/gems/
44
- # - vendor/ruby/
45
-
46
- #
47
4
  collections_dir: collections
48
5
  collections:
49
6
  wiki:
50
7
  output: true
51
8
  permalink: /:collection/:name
52
9
 
10
+ random_redirect:
11
+ pages: true
12
+
53
13
  # Front matter defaults, so you don't need to set layouts on every new page.
54
14
  # As long as pages are in the correct folder, they'll automatically have the
55
15
  # correct layout. You can override this via each page's front matter.
@@ -59,7 +19,7 @@ defaults:
59
19
  path: "" # an empty string here means all files in the project
60
20
  type: "pages"
61
21
  values:
62
- layout: "page"
22
+ layout: "page" # all pages will have the page.html layout unless overridden
63
23
  permalink: "/:path/:basename"
64
24
  -
65
25
  scope:
data/_data/navigation.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  - name: About
2
2
  link: /about
3
+ - name: Random
4
+ link: /random
3
5
  - name: Blog
4
6
  link: /blog
@@ -0,0 +1,30 @@
1
+ <section class="collections-header">
2
+
3
+ <section class="collections-stats">
4
+ {% for item in site.data.projects %}
5
+ {% if page.url contains item.link %}
6
+ Total number of {{ item.name | downcase }} entries:
7
+ {% if item.name == "Wiki" %}
8
+ {{ site.wiki.size }}
9
+ {% else %}
10
+ ? for now
11
+ {% endif %}
12
+ {% endif %}
13
+ {% endfor %}
14
+ </section>
15
+
16
+
17
+
18
+ <section class="collections-search">
19
+
20
+ {% for item in site.data.projects %}
21
+ {% if page.url contains item.link %}
22
+ <form action="{{ item.link }}:search" method="GET">
23
+ <input required type="search" class="collections-searchbar" placeholder="Search all {{ item.name | downcase }} entries" name="q">
24
+ </form>
25
+ {% endif %}
26
+ {% endfor %}
27
+
28
+ </section>
29
+
30
+ </section>
@@ -1,3 +1,15 @@
1
1
  <nav class="collections-sidebar">
2
2
 
3
+ {% for item in site.data.projects %}
4
+ {% if page.url contains item.link %}
5
+ <ul>
6
+ <li><a href="{{ item.link }}">Main page</a></li>
7
+ <li><a href="{{ item.link }}:contents">Contents</a></li>
8
+ <li><a href="{{ item.link }}:all">All entries</a></li>
9
+ <li><a href="{{ item.link }}:random">Random article</a></li>
10
+ <li><a href="{{ item.link }}:about">About</a></li>
11
+ </ul>
12
+ {% endif %}
13
+ {% endfor %}
14
+
3
15
  </nav>
@@ -17,7 +17,6 @@
17
17
 
18
18
  <form class="global-search" action="/search" method="GET">
19
19
  <input required type="search" class="global-searchbar" placeholder="Search" name="q">
20
- <!---<button type="submit" class="global-search_submit"><i class="ri-search-line"></i></button>--->
21
20
  </form>
22
21
 
23
22
  </nav>
@@ -0,0 +1,11 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ <nav class="entry-index">
6
+
7
+ </nav>
8
+
9
+ {{ content }}
10
+
11
+ <script src="/assets/js/toc.js"></script>
@@ -1,11 +1,7 @@
1
1
  ---
2
- layout: default
2
+ layout: entry
3
3
  ---
4
4
 
5
- <nav class="entry-index">
6
-
7
- </nav>
8
-
9
5
  <article class="entry entry-grammar">
10
6
 
11
7
  <h1>{{ page.title }}</h1>
@@ -13,5 +9,3 @@
13
9
  {{ content }}
14
10
 
15
11
  </article>
16
-
17
- <script src="/assets/js/toc.js"></script>
@@ -1,3 +1,63 @@
1
1
  ---
2
2
  layout: default
3
3
  ---
4
+
5
+ <div class="launchpad">
6
+
7
+
8
+
9
+ <section class="launchpad-search">
10
+
11
+ <form action="/search" method="GET">
12
+
13
+ <label for="input__text">What do you want to know?</label><br>
14
+ <input id="input__text" name="q" class="launchpad-searchbar" required type="search" placeholder="Search">
15
+
16
+ <input type="submit" class="launchpad-search_submit" value="Go">
17
+
18
+ </form>
19
+
20
+ </section>
21
+
22
+
23
+
24
+ <section class="launchpad-projects">
25
+
26
+ {% if site.multi_projects %}
27
+
28
+ {% for item in site.data.projects %}
29
+
30
+ <a href="{{ item.link }}" class="launchpad-card">
31
+ <i class="{{ item.icon }} project-icon"></i>
32
+ <header>{{ item.name }}</header>
33
+ {{ item.desc }}
34
+ </a>
35
+
36
+ {% endfor %}
37
+
38
+ {% else %}
39
+
40
+ <a href="/wiki" class="launchpad-card launchpad-card_wiki">
41
+ <i class="ri-footprint-line project-icon"></i>
42
+ <header>Explore the wiki!</header>
43
+ </a>
44
+
45
+ <a href="/wiki:contents" class="launchpad-card">
46
+ <i class="ri-file-list-2-line project-icon"></i>
47
+ <header>Contents</header>
48
+ Navigate the wiki
49
+ </a>
50
+
51
+ <a href="/wiki:random" class="launchpad-card">
52
+ <i class="ri-question-line project-icon"></i>
53
+ <header>Random</header>
54
+ Visit a random article
55
+ </a>
56
+
57
+ {% endif %}
58
+
59
+ </section>
60
+
61
+
62
+
63
+ </div>
@@ -2,25 +2,30 @@
2
2
  layout: collections
3
3
  ---
4
4
 
5
+ {% include collections_header.html %}
6
+
7
+
5
8
  <section class="reference-desk">
6
9
 
7
- {% if page.url == "/wiki" %}
8
10
  <header class="collections-portals">
9
- <h1 class="collections-portals_header">Pick a topic</h1>
10
11
  <nav class="collections-portals_grid">
11
12
 
12
- {% for item in site.data.portals_wiki %}
13
- <a href="{{ item.link }}" class="collections-portal_card">
14
- <header>
15
- <i class="{{ item.icon }} portal-icon"></i>
16
- {{ item.name }}
17
- </header>
18
- {{ item.summary }}
19
- </a>
13
+ {% for item in site.data.projects %}
14
+ {% if page.url contains item.link %}
15
+ {% for item in item.portals %}
16
+ <a href="{{ item.link }}" class="collections-portal_card">
17
+ <header>
18
+ <i class="{{ item.icon }} portal-icon"></i>
19
+ {{ item.portal }}
20
+ </header>
21
+ {{ item.summary }}
22
+ </a>
23
+ {% endfor %}
24
+ {% endif %}
20
25
  {% endfor %}
26
+
21
27
  </nav>
22
28
  </header>
23
- {% endif %}
24
29
 
25
30
  <section class="collections-wrapper">
26
31
 
data/_layouts/wiki.html CHANGED
@@ -1,51 +1,81 @@
1
1
  ---
2
- layout: default
2
+ layout: entry
3
3
  ---
4
4
 
5
- <nav class="entry-index">
5
+ <article class="entry entry-wiki">
6
6
 
7
- </nav>
8
7
 
9
- <article class="entry entry-wiki">
10
8
 
11
9
  <h1>
12
10
  {{ page.title }}
13
11
  </h1>
14
12
 
15
- <section class="entry-tags">
16
- <ul>
17
- <ul>
18
- <li>Portals:</li>
19
- <li><a href="/wiki/portal:{{ page.portal }}">{{ page.portal }}</a></li>
20
- </ul>
13
+
14
+
15
+ {% if page.other_projects %}
16
+
17
+ <section class="entry-other_projects">
18
+ View in other collections:
21
19
  <ul>
22
- <li>Categories:</li>
23
- {% for item in page.categories %}
20
+ {% for item in page.other_projects %}
24
21
  <li>
25
- <a href="/wiki/category:{{ item | slugify }}">
26
- {{ item }}
27
- </a>
22
+ <a href="/{{ item }}{{ page.url | remove_first: "/wiki" }}">{{ item | capitalize }}</a>
28
23
  </li>
29
24
  {% endfor %}
30
25
  </ul>
31
- <ul>
32
- <li>Tags:</li>
26
+ </section>
27
+
28
+ {% endif %}
29
+
30
+
31
+
32
+ <section class="entry-tags">
33
+
34
+ <div class="entry-subhead_pair">
35
+
36
+ <span class="entry-subhead_key">Portals:</span>
37
+ <span>
38
+ <a href="/wiki/portal:{{ page.portal }} class="entry-subhead_value"">
39
+ {{ page.portal }}
40
+ </a>
41
+ </span>
42
+
43
+ </div>
44
+
45
+ <div class="entry-subhead_pair">
46
+
47
+ <span class="entry-subhead_key">Categories:</span>
48
+ <span>
49
+ {% for item in page.categories %}
50
+ <a href="/wiki/category:{{ item | slugify }}" class="entry-subhead_value">
51
+ {{ item }}
52
+ </a>
53
+ {% endfor %}
54
+ </span>
55
+
56
+ </div>
57
+
58
+ <div class="entry-subhead_pair">
59
+
60
+ <span class="entry-subhead_key">Tags:</span>
61
+ <span>
33
62
  {% for item in page.tags %}
34
- <li>
35
- <a href="/wiki/tag:{{ item | slugify }}">
36
- {{ item }}
37
- </a>
38
- </li>
63
+ <a href="/wiki/tag:{{ item }}" class="entry-subhead_value">
64
+ {{ item }}
65
+ </a>
39
66
  {% endfor %}
40
- </li>
41
- </ul>
42
- </ul>
67
+ </span>
68
+
69
+ </div>
70
+
43
71
  </section>
44
72
 
45
73
  {{ content }}
46
74
 
47
75
  </article>
48
76
 
77
+
78
+
49
79
  {% if page.quickstats %}
50
80
 
51
81
  <section class="entry-quickstats">
@@ -92,5 +122,3 @@
92
122
  </section>
93
123
 
94
124
  {% endif %}
95
-
96
- <script src="/assets/js/toc.js"></script>
data/_layouts/work.html CHANGED
@@ -1,11 +1,7 @@
1
1
  ---
2
- layout: default
2
+ layout: entry
3
3
  ---
4
4
 
5
- <nav class="entry-index">
6
-
7
- </nav>
8
-
9
5
  <article class="entry entry-work">
10
6
 
11
7
  <h1>{{ page.title }}</h1>
@@ -13,5 +9,3 @@
13
9
  {{ content }}
14
10
 
15
11
  </article>
16
-
17
- <script src="/assets/js/toc.js"></script>
@@ -0,0 +1,41 @@
1
+ ---
2
+ # Jekyll page that redirects to a random page, post or document
3
+ # https://github.com/jekylltools/jekyll-random-redirect
4
+ # v1.6
5
+ permalink: /random
6
+ ---
7
+
8
+ {%- assign docs = site.posts -%}
9
+
10
+ {%- if site.random_redirect.pages == true -%}
11
+ {%- assign pages = site.documents | where_exp:"page","page.url != '/random/'" -%}
12
+ {%- assign docs = docs | concat: pages -%}
13
+ {%- endif -%}
14
+
15
+ {%- if site.random_redirect.documents == true -%}
16
+ {%- assign docs = docs | concat: site.documents | uniq -%}
17
+ {%- endif -%}
18
+
19
+ <script type="text/javascript">
20
+ var urls=[];
21
+
22
+ {% for doc in docs -%}
23
+ urls.push("{{ doc.url | absolute_url }}");
24
+ {% endfor -%}
25
+
26
+ var url = urls[Math.floor(Math.random()*urls.length)];
27
+ var link = document.createElement('link');
28
+ link.setAttribute('rel', 'canonical');
29
+ link.setAttribute('href', url);
30
+ document.head.appendChild(link);
31
+
32
+ if (typeof IE_fix != "undefined") {
33
+ document.write("Redirecting...");
34
+ var referLink = document.createElement("a");
35
+ referLink.href = url;
36
+ document.body.appendChild(referLink);
37
+ referLink.click();
38
+ } else {
39
+ window.location.replace(url);
40
+ }
41
+ </script>
data/_pages/search.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  <script>
11
11
  window.pages = {
12
- {% for page in site.wiki %}
12
+ {% for page in site.documents %}
13
13
  "{{ page.url | slugify }}": {
14
14
  "title": "{{ page.title | xml_escape }}",
15
15
  "content": {{ page.content | markdownify | strip_newlines | strip_html | jsonify }},
@@ -20,5 +20,6 @@
20
20
  };
21
21
  </script>
22
22
 
23
+
23
24
  <script src="/assets/js/lunr.js"></script>
24
25
  <script src="/assets/js/search.js"></script>
@@ -0,0 +1,4 @@
1
+ ---
2
+ layout: reference_desk
3
+ permalink: /wiki
4
+ ---
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  layout: collections
3
3
  title: All wiki articles
4
- permalink: /wiki
4
+ permalink: /wiki:all
5
5
  ---
6
6
 
7
7
  <ul class="collections_list">
@@ -0,0 +1,19 @@
1
+ ---
2
+ layout: collections
3
+ title: Wiki contents
4
+ permalink: /wiki:contents
5
+ ---
6
+
7
+ The information in this wiki is organized into the following subject portals. Each portal broadly surveys and is further organized into various levels of subcategories.
8
+
9
+ {% for item in site.data.portals_wiki %}
10
+ <dl class="">
11
+ <dd><a href="{{ item.link }}">{{ item.name }}</a></dd>
12
+ <dt>{{ item.contents }}</dt>
13
+ </dl>
14
+ {% endfor %}
15
+
16
+ ## Special categories
17
+
18
+ + Timelines
19
+ + Glossaries
@@ -0,0 +1,41 @@
1
+ ---
2
+ # Jekyll page that redirects to a random page, post or document
3
+ # https://github.com/jekylltools/jekyll-random-redirect
4
+ # v1.6
5
+ permalink: /wiki:random
6
+ ---
7
+
8
+ {%- assign docs = site.posts -%}
9
+
10
+ {%- if site.random_redirect.pages == true -%}
11
+ {%- assign pages = site.wiki | where_exp:"page","page.url != '/random/'" -%}
12
+ {%- assign docs = docs | concat: pages -%}
13
+ {%- endif -%}
14
+
15
+ {%- if site.random_redirect.documents == true -%}
16
+ {%- assign docs = docs | concat: site.documents | uniq -%}
17
+ {%- endif -%}
18
+
19
+ <script type="text/javascript">
20
+ var urls=[];
21
+
22
+ {% for doc in docs -%}
23
+ urls.push("{{ doc.url | absolute_url }}");
24
+ {% endfor -%}
25
+
26
+ var url = urls[Math.floor(Math.random()*urls.length)];
27
+ var link = document.createElement('link');
28
+ link.setAttribute('rel', 'canonical');
29
+ link.setAttribute('href', url);
30
+ document.head.appendChild(link);
31
+
32
+ if (typeof IE_fix != "undefined") {
33
+ document.write("Redirecting...");
34
+ var referLink = document.createElement("a");
35
+ referLink.href = url;
36
+ document.body.appendChild(referLink);
37
+ referLink.click();
38
+ } else {
39
+ window.location.replace(url);
40
+ }
41
+ </script>