Skip to content

Commit

Permalink
add rel="noopener" when target="_blank"
Browse files Browse the repository at this point in the history
  • Loading branch information
JOduMonT committed Jan 19, 2019
1 parent 1494aed commit a48b5e8
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion _includes/image.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<figure>{% if {{include.url}} %}<a class="no_icon" target="_blank" href="{{include.url}}">{% endif %}<img class="docimage" src="images/{{include.file}}" alt="{{include.alt}}" {% if {{include.max-width}} %}style="max-width: {{include.max-width}}px"{% endif %} />{% if {{include.url}} %}</a>{% endif %}{% if {{include.caption}} %}<figcaption>{{include.caption}}</figcaption>{% endif %}</figure>
<figure>{% if {{include.url}} %}<a class="no_icon" target="_blank" rel="noopener" href="{{include.url}}">{% endif %}<img class="docimage" src="images/{{include.file}}" alt="{{include.alt}}" {% if {{include.max-width}} %}style="max-width: {{include.max-width}}px"{% endif %} />{% if {{include.url}} %}</a>{% endif %}{% if {{include.caption}} %}<figcaption>{{include.caption}}</figcaption>{% endif %}</figure>
4 changes: 2 additions & 2 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% for folderitem in folder.folderitems %}
{% if folderitem.output contains "web" %}
{% if folderitem.external_url %}
<li><a href="{{folderitem.external_url}}" target="_blank">{{folderitem.title}}</a></li>
<li><a href="{{folderitem.external_url}}" target="_blank" rel="noopener">{{folderitem.title}}</a></li>
{% elsif page.url == folderitem.url %}
<li class="active"><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
{% elsif folderitem.type == "empty" %}
Expand All @@ -28,7 +28,7 @@
{% for subfolderitem in subfolders.subfolderitems %}
{% if subfolderitem.output contains "web" %}
{% if subfolderitem.external_url %}
<li><a href="{{subfolderitem.external_url}}" target="_blank">{{subfolderitem.title}}</a></li>
<li><a href="{{subfolderitem.external_url}}" target="_blank" rel="noopener">{{subfolderitem.title}}</a></li>
{% elsif page.url == subfolderitem.url %}
<li class="active"><a href="{{subfolderitem.url | remove: "/"}}">{{subfolderitem.title}}</a></li>
{% else %}
Expand Down
4 changes: 2 additions & 2 deletions _includes/topnav.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% for entry in topnav.topnav %}
{% for item in entry.items %}
{% if item.external_url %}
<li><a href="{{item.external_url}}" target="_blank">{{item.title}}</a></li>
<li><a href="{{item.external_url}}" target="_blank" rel="noopener">{{item.title}}</a></li>
{% elsif page.url contains item.url %}
<li class="active"><a href="{{item.url | remove: "/"}}">{{item.title}}</a></li>
{% else %}
Expand All @@ -39,7 +39,7 @@
<ul class="dropdown-menu">
{% for folderitem in folder.folderitems %}
{% if folderitem.external_url %}
<li><a href="{{folderitem.external_url}}" target="_blank">{{folderitem.title}}</a></li>
<li><a href="{{folderitem.external_url}}" target="_blank" rel="noopener">{{folderitem.title}}</a></li>
{% elsif page.url contains folderitem.url %}
<li class="dropdownActive"><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
{% else %}
Expand Down
2 changes: 1 addition & 1 deletion _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h1 class="post-title-main">{{ page.title }}</h1>

{% if site.github_editme_path %}

<a target="_blank" href="https://github.com/{{site.github_editme_path}}{{page.path}}" class="btn btn-default githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>
<a target="_blank" rel="noopener" href="https://github.com/{{site.github_editme_path}}{{page.path}}" class="btn btn-default githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>

{% endif %}

Expand Down
4 changes: 2 additions & 2 deletions pages/mydoc/mydoc_commenting_on_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Here's the code for that button on the page.html layout for GitHub:
```
{% raw %}{% if site.github_editme_path %}
<a target="_blank" href="https://github.com/{{site.github_editme_path}}/{{page.folder}}{{page.url | append: ".md"}}{% endif %}" class="btn btn-default githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>
<a target="_blank" rel="noopener" href="https://github.com/{{site.github_editme_path}}/{{page.folder}}{{page.url | append: ".md"}}{% endif %}" class="btn btn-default githubEditButton" role="button"><i class="fa fa-github fa-lg"></i> Edit me</a>
{% endif %}{% endraw %}
```
Expand All @@ -33,7 +33,7 @@ and here for GitLab:
```
{% raw %}{% if site.gitlab_editme_path %}
<a target="_blank" href="https://github.com/{{site.gitlab_editme_path}}/{{page.folder}}{{page.url | append: ".md"}}{% endif %}" class="btn btn-default githubEditButton" role="button"><i class="fa fa-gitlab fa-lg"></i> Edit me</a>
<a target="_blank" rel="noopener" href="https://github.com/{{site.gitlab_editme_path}}/{{page.folder}}{{page.url | append: ".md"}}{% endif %}" class="btn btn-default githubEditButton" role="button"><i class="fa fa-gitlab fa-lg"></i> Edit me</a>
{% endif %}{% endraw %}
```
Expand Down
2 changes: 1 addition & 1 deletion pages/mydoc/mydoc_generating_pdfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ What this does is allow the prince-list.txt and toc.html files to iterate throug
You can add a download button for your PDF using some Bootstrap button code:
```html
<a target="_blank" class="noCrossRef" href="/pdf/mydoc.pdf"><button type="button" class="btn btn-default" aria-label="Left Align"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> PDF Download</button></a>
<a target="_blank" rel="noopener" class="noCrossRef" href="/pdf/mydoc.pdf"><button type="button" class="btn btn-default" aria-label="Left Align"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> PDF Download</button></a>
```

Here's what that looks like:
Expand Down
8 changes: 4 additions & 4 deletions pages/mydoc/mydoc_help_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can create a help API that developers can use to pull in content.

For the full code demo, see the notes in the [Tooltips file](tooltips.html).

In this demo, the popovers pull in and display content from the information in a <a target="_blank" href="tooltips.json">tooltips.json</a> file located in the same directory.
In this demo, the popovers pull in and display content from the information in a <a target="_blank" rel="noopener" href="tooltips.json">tooltips.json</a> file located in the same directory.

Instead of placing the JSON source in the same directory, you could also host the JSON file on another site.

Expand Down Expand Up @@ -134,7 +134,7 @@ This code will loop through all pages in the tooltips collection and insert the
}
```

You can also view the same JSON file here: <a target="_blank" href="tooltips.json">tooltips.json</a>.
You can also view the same JSON file here: <a target="_blank" rel="noopener" href="tooltips.json">tooltips.json</a>.

You can add different fields depending on how you want the JSON to be structured. Here we just have to fields: `doc_id` and `body`. And the JSON is looking just in the tooltips collection that we created.

Expand Down Expand Up @@ -236,7 +236,7 @@ Developers can access the help using the `.get` method from jQuery, among other
});{% endraw %}
```

View the <a target="_blank" href="tooltips.html" class="noCrossRef">tooltip demo</a> for a demonstration. See the source code for full code details.
View the <a target="_blank" rel="noopener" href="tooltips.html" class="noCrossRef">tooltip demo</a> for a demonstration. See the source code for full code details.

The `url` in the demo is relative, but you could equally point it to an absolute path on a remote host assuming CORS is enabled on the host.

Expand Down Expand Up @@ -275,7 +275,7 @@ Again, see the <a class="noCrossRef" href="tooltips.html">Tooltip Demo</a> for a

Note that even though you reference a Bootstrap JS script, Bootstrap's popovers require you to initialize them using the above code as well &mdash; they aren't turned on by default.

View the source code of the <a target="_blank" href="tooltips.html" class="noCrossRef">tooltip demo</a> for the full comments.
View the source code of the <a target="_blank" rel="noopener" href="tooltips.html" class="noCrossRef">tooltip demo</a> for the full comments.

## 8. Create easy links to embed the help in your help site

Expand Down
2 changes: 1 addition & 1 deletion pages/mydoc/mydoc_sidebar_navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ For example, the sidebar.html file contains the following code:
{% raw %}
```liquid
{% if folderitem.external_url %}
<li><a href="{{folderitem.external_url}}" target="_blank">{{folderitem.title}}</a></li>
<li><a href="{{folderitem.external_url}}" target="_blank" rel="noopener">{{folderitem.title}}</a></li>
```
{% endraw %}

Expand Down
4 changes: 2 additions & 2 deletions pdfconfigs/prince-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ search: exclude
{% for folderitem in folder.folderitems %}
{% if folderitem.output contains "web" %}
{% if folderitem.external_url %}
<li><a href="{{folderitem.external_url}}" target="_blank">{{folderitem.title}}</a></li>
<li><a href="{{folderitem.external_url}}" target="_blank" rel="noopener">{{folderitem.title}}</a></li>
{% elsif page.url == folderitem.url %}
<li class="active"><a href="{{folderitem.url | remove: "/"}}">{{folderitem.title}}</a></li>
{% elsif folderitem.type == "empty" %}
Expand All @@ -60,7 +60,7 @@ search: exclude
{% for subfolderitem in subfolders.subfolderitems %}
{% if subfolderitem.output contains "web" %}
{% if subfolderitem.external_url %}
<li><a href="{{subfolderitem.external_url}}" target="_blank">{{subfolderitem.title}}</a></li>
<li><a href="{{subfolderitem.external_url}}" target="_blank" rel="noopener">{{subfolderitem.title}}</a></li>
{% elsif page.url == subfolderitem.url %}
<li class="active"><a href="{{subfolderitem.url | remove: "/"}}">{{subfolderitem.title}}</a></li>
{% else %}
Expand Down

0 comments on commit a48b5e8

Please sign in to comment.