Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion _includes/_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
</style>
<button id="searchbox-button">
<svg style="width:16px;height:16px" viewBox="0 0 24 24"><path fill="currentColor" d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>
<svg style="width:16px;height:16px;margin-right:8px;" viewBox="0 0 24 24"><path fill="currentColor" d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg>
Search
</button>

Expand Down Expand Up @@ -161,6 +161,9 @@
'event_category': 'docs-engagement',
'search_term': query,
});
const path = 'https://docs2-cl-default-rtdb.firebaseio.com/search.json';
const data = {query,time:Date.now(),url:window.location.href};
SULX.post(path, JSON.stringify(data));
searchTimeout = null;
},1000);
console.log(searchTimeout);
Expand Down
97 changes: 48 additions & 49 deletions _includes/main.liquid
Original file line number Diff line number Diff line change
@@ -1,60 +1,59 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8">
{% unless title %}
{% assign title="Blockchain Oracles for Connected Smart Contracts" %}
{% endunless %}
<title>{{title}} | Chainlink Documentation</title>
<meta content="{{title}} | Chainlink Documentation" property="og:title">
<meta content="{{title}} | Chainlink Documentation" property="twitter:title">
<head>
<meta charset="utf-8">
{% unless title %}
{% assign title="Blockchain Oracles for Connected Smart Contracts" %}
{% endunless %}
<title>{{title}}
| Chainlink Documentation</title>
<meta content="{{title}} | Chainlink Documentation" property="og:title">
<meta content="{{title}} | Chainlink Documentation" property="twitter:title">

{% unless metadata.description %}
{% assign metadata.description="Chainlink is the most widely used oracle network for powering universally connected smart contracts, enabling any blockchain to access to real-world data &amp; APIs" %}
{% endunless %}
<meta content="{{metadata.description}}" name="description">
<meta content="{{metadata.description}}" property="og:description">
<meta content="{{metadata.description}}" property="twitter:description">
{% if metadata.image[0] %}
<meta content="{{metadata.image[0]}}" property="og:image">
<meta content="{{metadata.image[0]}}" property="twitter:image">
{% else %}
<meta
content="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa2e075cfcf344baa0e9063_chainlink-open-graph-images_home%20(with%20illustration).png"
property="og:image">
<meta
content="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa2e075cfcf344baa0e9063_chainlink-open-graph-images_home%20(with%20illustration).png"
property="twitter:image">
{% endif %}
{% unless metadata.description %}
{% assign metadata.description="Chainlink is the most widely used oracle network for powering universally connected smart contracts, enabling any blockchain to access to real-world data &amp; APIs" %}
{% endunless %}
<meta content="{{metadata.description}}" name="description">
<meta content="{{metadata.description}}" property="og:description">
<meta content="{{metadata.description}}" property="twitter:description">
{% if metadata.image[0] %}
<meta content="{{metadata.image[0]}}" property="og:image">
<meta content="{{metadata.image[0]}}" property="twitter:image">
{% else %}
<meta content="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa2e075cfcf344baa0e9063_chainlink-open-graph-images_home%20(with%20illustration).png" property="og:image">
<meta content="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa2e075cfcf344baa0e9063_chainlink-open-graph-images_home%20(with%20illustration).png" property="twitter:image">
{% endif %}

<meta property="og:type" content="website">
<meta content="summary_large_image" name="twitter:card">
<meta content="width=device-width, initial-scale=1" name="viewport">
{% if hidden %}
<!-- Allow hidden content -->
<meta name="robots" content="noindex" />
{% endif %}
<meta content="website" property="og:type">
<meta content="summary_large_image" name="twitter:card">
<meta content="width=device-width, initial-scale=1" name="viewport">

{% if hidden %}
<!-- Allow hidden content -->
<meta content="noindex" name="robots"/>
{% endif %}

<!-- Syntax Highlight-->
<link href="/prism.css" rel="stylesheet"type="text/css">
<script src="/prism.js"></script>
<script src="/tab.js"></script>
<script src="/sul.js"></script>
<!-- Syntax Highlight-->
<link href="/prism.css" rel="stylesheet" type="text/css">
<script src="/prism.js"></script>
<script src="/tab.js"></script>
<script src="/sul.js"></script>


<link href="/docs.css" rel="stylesheet" type="text/css">
<link href="/docs.css" rel="stylesheet" type="text/css">

<link
href="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa97474da20bc75f63bfdc4_Chainlink-favicon-32.png"
rel="shortcut icon" type="image/x-icon">
<link
href="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa973e31adbc3414aa8f77d_Chainlink-webclip.png"
rel="apple-touch-icon">
<link href="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa97474da20bc75f63bfdc4_Chainlink-favicon-32.png" rel="shortcut icon" type="image/x-icon">
<link href="https://assets-global.website-files.com/5f6b7190899f41fb70882d08/5fa973e31adbc3414aa8f77d_Chainlink-webclip.png" rel="apple-touch-icon">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-128878871-16"></script>
<script
type="text/javascript">window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'UA-128878871-16');</script>
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-128878871-16");
</script>

<script>
// Detect highlighting
Expand Down Expand Up @@ -97,8 +96,8 @@
src="/chainlink-docs.svg"
loading="lazy" style="height:40px;width:176px;max-width:176px" alt="Chainlink Developers"></a>
<span style="flex-grow:1;"></span>
<div><a href="/" {% if section == "smartContract" %} class="active" {% endif %}>Contract Developers</a></div>
<div><a href="/chainlink-nodes" {% unless section == "smartContract" %} class="active" {% endunless %}>Node Operators</a></div>
<div class="tab"><a href="/" {% if section == "smartContract" %} class="active" {% endif %}>Contract Developers</a></div>
<div class="tab"><a href="/chainlink-nodes" {% unless section == "smartContract" %} class="active" {% endunless %}>Node Operators</a></div>

<span style="flex-grow:1;"></span>

Expand Down
34 changes: 19 additions & 15 deletions _includes/squash.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
/**
* Make a search index string by removing duplicated words
* and removing less useful, common short words
* and removing less useful, common words
*
* @param {String} text
*/

module.exports = function(text) {
var content = new String(text);
module.exports = function (text) {
let content = new String(text);

// all lower case, please
var content = content.toLowerCase();
content = content.toLowerCase();

// remove all html elements and new lines
var re = /(&lt;.*?&gt;)/gi;
var plain = unescape(content.replace(re, ''));
let re = /(&lt;.*?&gt;)/gi;
let plain = unescape(content.replace(re, ''));

// remove html entities and code
let stripped = plain.replace(/&quot;/g,'');
stripped = stripped.match(/(\b[a-zA-Z'-]{3,}\b)/g).join(' ')
let stripped = plain.replace(/&quot;/g, '');
stripped = stripped.match(/(\b[a-zA-Z'-]{3,}\b)/g).join(' ');

// remove duplicated words
var words = stripped.split(' ');
var deduped = [...(new Set(words))];
var dedupedStr = deduped.join(' ')
let words = stripped.split(' ');
let deduped = [...new Set(words)];
let dedupedStr = deduped.join(' ');

// remove short and less meaningful words
var result = dedupedStr.replace(/\b(\.|\,|the|a|an|and|am|you|I|to|if|of|off|me|my|on|in|it|is|at|as|we|do|be|has|but|was|so|no|not|or|up|for)\b/gi, '');
let result = dedupedStr.replace(
/\b(\.|\,|the|a|an|and|am|you|I|to|if|of|off|me|my|on|in|it|is|at|as|we|do|be|has|but|was|so|no|not|or|up|for)\b/gi,
''
);

// Remove newlines, and punctuation
result = result.replace(/\.|\,|\?|-|—|\n/g, '');

// Remove repeated spaces
result = result.replace(/[ ]{2,}/g, ' ');

// Remove slashes that were not being properly escaped by nunjucks.
result = result.replace(/\\/g,'');
result = result.replace(/\\/g, '');

return result;
}
};
11 changes: 11 additions & 0 deletions _includes/still-questions.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div class="cl-box cl-box-blue">
<h2>Still have questions?</h2>
<p style="margin-bottom:0;">Find answers to our most commonly asked questions.</p>
<div>
<a class="cl-button--ghost" href="/docs/faq">FAQ</a>
<a class="cl-button--ghost" href="https://discord.gg/2YHSAey">Discord</a>
<a class="cl-button--ghost" href="https://github.com/smartcontractkit/chainlink">Github</a>
</div>
<h3>中文开发者社区</h3>
<img height="auto" src="https://files.readme.io/f639125-qr.png" width="30%"/>
</div>
Loading