diff --git a/assets/js/rss/index.ts b/assets/js/rss/index.ts new file mode 100644 index 00000000..416b882a --- /dev/null +++ b/assets/js/rss/index.ts @@ -0,0 +1,14 @@ +import Component from "js/component"; +import { isSafari } from "js/helper"; + +export default class RSS implements Component { + run() { + if (true || isSafari()) { + document + .querySelectorAll("a[data-rss-feed]") + .forEach((link) => { + link.href = "feed:" + link.href; + }); + } + } +} diff --git a/assets/main/js/index.ts b/assets/main/js/index.ts index 7ffebe36..b1f83dab 100644 --- a/assets/main/js/index.ts +++ b/assets/main/js/index.ts @@ -12,6 +12,7 @@ import Scroller from "js/scroller"; import SidebarToggle from "js/sidebar-toggle"; import TableWrapper from "js/table-wrapper"; import TOC from "js/toc"; +import RSS from "js/rss"; import components from "./components"; import "js/slide"; import "js/search"; @@ -27,6 +28,7 @@ new Docs().run(); new FormValidator().run(); new TOC("#post-toc-container", ".sidebar #TableOfContents").run(); new IFrame().run(); +new RSS().run(); const app = new App(); app.attach(...components); diff --git a/layouts/partials/helpers/social-links.html b/layouts/partials/helpers/social-links.html index 701c99f1..e6cfca09 100644 --- a/layouts/partials/helpers/social-links.html +++ b/layouts/partials/helpers/social-links.html @@ -82,7 +82,7 @@ {{- end }} {{- end }} {{- with $rss }} - + {{- if $iconText }} RSS