Skip to content

Commit ebca321

Browse files
authored
🔥Removes linkable_title everywhere (home-assistant#9772)
* Automatically create linkable headers * Visually improve position of linkable header chain icon * Do not auto link headers on homepage * Remove linkable_title everywhere * 🚑 Re-instante linkable_title plugin as NOOP
1 parent e6605e5 commit ebca321

File tree

1,002 files changed

+4820
-4801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,002 files changed

+4820
-4801
lines changed

plugins/linkable_title.rb

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
module Jekyll
2-
class LinkableTitleTag < Liquid::Tag
3-
def initialize(tag_name, text, token)
4-
super
5-
@title = text
6-
end
1+
module Jekyll
2+
class LinkableTitleTag < Liquid::Tag
3+
def initialize(tag_name, text, token)
4+
super
5+
@title = text
6+
end
77

8-
def render(context)
9-
title = Liquid::Template.parse(@title).render context
10-
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
11-
"<a class='title-link' name='#{slug}' href='\##{slug}'></a> #{title}"
12-
end
13-
end
14-
end
8+
def render(context)
9+
title = Liquid::Template.parse(@title).render context
10+
"#{title}"
11+
end
12+
end
13+
end
1514

16-
Liquid::Template.register_tag('linkable_title', Jekyll::LinkableTitleTag)
15+
Liquid::Template.register_tag('linkable_title', Jekyll::LinkableTitleTag)

plugins/no_follow.rb

Lines changed: 0 additions & 33 deletions
This file was deleted.

plugins/output_modder.rb

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Jekyll Out Modder - Allows for mangling/modding the HTML output
2+
#
3+
# This is combined in a single plugin/filter to reduce the NokoGiri dom
4+
# parsing to just once per page/content.
5+
#
6+
# - Automatically adds rel='external nofollow' to outgoing links.
7+
# - Automatically make headers linkable
8+
#
9+
require 'jekyll'
10+
require 'nokogiri'
11+
12+
module Jekyll
13+
module OutputModder
14+
def output_modder(content)
15+
dom = Nokogiri::HTML.fragment(content)
16+
17+
# Find all links, make all external links rel='external nofollow'
18+
dom.css('a').each do |link|
19+
rel = ['external', 'nofollow']
20+
21+
# All external links start with 'http', skip when this one does not
22+
next unless link.get_attribute('href') =~ /\Ahttp/i
23+
24+
# Play nice with our own links
25+
next if link.get_attribute('href') =~ /\Ahttps?:\/\/\w*.?home-assistant.io/i
26+
27+
# Play nice with links that already have a rel attribute set
28+
rel.unshift(link.get_attribute('rel'))
29+
30+
# Add rel attribute to link
31+
link.set_attribute('rel', rel.join(' ').strip)
32+
end
33+
34+
# Find all headers, make them linkable
35+
dom.css('h2,h3,h4,h5,h6,h7,h8').each do |header|
36+
37+
# Skip linked headers
38+
next if header.at_css('a')
39+
40+
title = header.content
41+
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
42+
header.children = "<a class='title-link' name='#{slug}' href='\##{slug}'></a> #{title}"
43+
end
44+
45+
dom.to_s
46+
end
47+
end
48+
end
49+
50+
Liquid::Template.register_filter(Jekyll::OutputModder)

sass/custom/_paulus.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ dt:hover a.title-link {
210210

211211
&::before {
212212
position: absolute;
213-
top: 2px;
213+
top: 5px;
214214
left: -25px;
215215
padding-right: 40px;
216216
font-family: "FontAwesome";

source/_addons/check_config.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ footer: true
1111

1212
You can use this add-on to check whether your configuration files are valid against the new version of Home Assistant before you actually update your Home Assistant installation. This add-on will help you avoid errors due to breaking changes, resulting in a smooth update.
1313

14-
### {% linkable_title How to use this add-on %}
14+
### How to use this add-on
1515

1616
1. Just start the add-on.
1717
2. Wait (On a Raspberry Pi it can take several minutes).
1818
3. If you see the following output then you are good to go to update Home Assistant: `[Info] Configuration check finished - no error found! :)`.
1919

2020
If you get errors, then you should look for **Breaking Changes** against the version you specified for this add-on and change your configuration accordingly.
2121

22-
### {% linkable_title Add-on configuration %}
22+
### Add-on configuration
2323

2424
```json
2525
{

source/_addons/configurator.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ More information and a standalone version for regular Home Assistant installatio
2020
Screenshot of the HASS Configurator.
2121
</p>
2222

23-
### {% linkable_title Feature list %}
23+
### Feature list
2424

2525
- Web-based editor to modify your files with syntax highlighting and YAML linting.
2626
- Upload and download files.
@@ -32,7 +32,7 @@ Screenshot of the HASS Configurator.
3232
- Editor settings are saved in your browser.
3333
- And much more...
3434

35-
### {% linkable_title Add-on Configuration %}
35+
### Add-on Configuration
3636

3737
```json
3838
{
@@ -54,6 +54,6 @@ enforce_basepath:
5454
default: false
5555
{% endconfiguration %}
5656

57-
### {% linkable_title Old port based Access %}
57+
### Old port based Access
5858

5959
You can set a network Port and the Add-on listens on that Port with Home Assistant user credential. That is as a backup if you are not able to connect to Home Assistant anymore. Today, you can restart Home Assistant with broken config, but maybe some times usefully.

source/_addons/duckdns.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ seconds:
4949
type: integer
5050
{% endconfiguration %}
5151

52-
## {% linkable_title Home Assistant configuration %}
52+
## Home Assistant configuration
5353

5454
Use the following configuration in Home Assistant to use the generated certificate:
5555

@@ -62,15 +62,15 @@ http:
6262
6363
If you use a port other than `8123` or an SSL proxy, change the port number accordingly.
6464

65-
## {% linkable_title Router configuration %}
65+
## Router configuration
6666

6767
You'll need to forward the port you listed in your configuration (8123 in the example above) on your router to your Home Assistant system. You can find guides on how to do this on [Port Forward](https://portforward.com/). Noting that you'll only need to forward the TCP port.
6868

6969
Ensure that you allocate the Home Assistant system a fixed IP on your network before you configure port forwarding. You can do this either on the computer itself (see the [install guide](/hassio/installation/) or via a static lease on your router.
7070

7171
Restart Home Assistant for the configured changes to take effect. When you access the Home Assistant frontend you will now need to use `https`, even when accessing local instances, for example at `https://192.168.0.1:8123`.
7272

73-
## {% linkable_title Generate Let's Encrypt certificate for Duck DNS sub sub domains %}
73+
## Generate Let's Encrypt certificate for Duck DNS sub sub domains
7474

7575
To generate certificates for nr.my-domain.duckdns.org update the domain JSON settings to:
7676

source/_addons/google_assistant.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ speaker:
7979
type: string
8080
{% endconfiguration %}
8181

82-
### {% linkable_title Home Assistant configuration %}
82+
### Home Assistant configuration
8383

8484
Use the Home Assistant [DialogFlow component][comp] to integrate the add-on into Home Assistant.
8585

source/_addons/homematic.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ hmip:
103103
type: string
104104
{% endconfiguration %}
105105

106-
## {% linkable_title Home Assistant configuration %}
106+
## Home Assistant configuration
107107

108108
Use the following configuration in Home Assistant to use it:
109109

@@ -121,14 +121,14 @@ homematic:
121121
port: 2010
122122
```
123123
124-
## {% linkable_title Raspberry Pi3 %}
124+
## Raspberry Pi3
125125
126126
With HM-MOD-RPI-PCB you need to add follow into your `config.txt` on boot partition:
127127

128128
```text
129129
dtoverlay=pi3-miniuart-bt
130130
```
131131

132-
## {% linkable_title HmIP-RFUSB %}
132+
## HmIP-RFUSB
133133

134134
HassOS > 1.11 support HmIP-RFUSB default and don't need any configuration. If you run a Linux, you need to follow the installation guide from documentation to set up the UART USB interface on your computer.

source/_addons/lets_encrypt.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ keyfile:
4545
default: privkey.pem
4646
{% endconfiguration %}
4747

48-
## {% linkable_title Home Assistant configuration %}
48+
## Home Assistant configuration
4949

5050
Use the following configuration in Home Assistant to use the generated certificate:
5151

@@ -58,7 +58,7 @@ http:
5858
5959
If you use another port such as `8123` or an SSL proxy, change the port number.
6060

61-
## {% linkable_title Enabling auto-renewals %}
61+
## Enabling auto-renewals
6262

6363
Out of the box, the add-on will not automatically renew your certificate. In fact, it only starts, tries to get/renew your certificate, and then stops. It's up to you to manually start it again whenever your certificate comes close to expiry.
6464

0 commit comments

Comments
 (0)