]> Untitled Git - lemmy-ui.git/commitdiff
Adding rss links. Fixes #548 (#549)
authorDessalines <dessalines@users.noreply.github.com>
Tue, 25 Jan 2022 03:24:32 +0000 (22:24 -0500)
committerGitHub <noreply@github.com>
Tue, 25 Jan 2022 03:24:32 +0000 (22:24 -0500)
src/shared/components/community/community.tsx
src/shared/components/home/home.tsx
src/shared/components/person/inbox.tsx
src/shared/components/person/profile.tsx

index cdab971c2caba827ce5da699fc0229730230cf49..db56bccea223154c267f00c8073441832366b178 100644 (file)
@@ -354,6 +354,10 @@ export class Community extends Component<any, State> {
   }
 
   selects() {
+    let communityRss = communityRSSUrl(
+      this.state.communityRes.community_view.community.actor_id,
+      this.state.sort
+    );
     return (
       <div class="mb-3">
         <span class="mr-3">
@@ -365,16 +369,10 @@ export class Community extends Component<any, State> {
         <span class="mr-2">
           <SortSelect sort={this.state.sort} onChange={this.handleSortChange} />
         </span>
-        <a
-          href={communityRSSUrl(
-            this.state.communityRes.community_view.community.actor_id,
-            this.state.sort
-          )}
-          title="RSS"
-          rel="noopener"
-        >
+        <a href={communityRss} title="RSS" rel="noopener">
           <Icon icon="rss" classes="text-muted small" />
         </a>
+        <link rel="alternate" type="application/atom+xml" href={communityRss} />
       </div>
     );
   }
index d64a8528d32b35faebed32ba88e87c596dbf6763..5d430a6b06e1b5d2fb7cc3500671f58ba3a2d98c 100644 (file)
@@ -669,6 +669,12 @@ export class Home extends Component<any, HomeState> {
   }
 
   selects() {
+    let allRss = `/feeds/all.xml?sort=${this.state.sort}`;
+    let localRss = `/feeds/local.xml?sort=${this.state.sort}`;
+    let frontRss = UserService.Instance.myUserInfo
+      ? `/feeds/front/${UserService.Instance.auth}.xml?sort=${this.state.sort}`
+      : "";
+
     return (
       <div className="mb-3">
         <span class="mr-3">
@@ -688,32 +694,33 @@ export class Home extends Component<any, HomeState> {
           <SortSelect sort={this.state.sort} onChange={this.handleSortChange} />
         </span>
         {this.state.listingType == ListingType.All && (
-          <a
-            href={`/feeds/all.xml?sort=${this.state.sort}`}
-            rel="noopener"
-            title="RSS"
-          >
-            <Icon icon="rss" classes="text-muted small" />
-          </a>
+          <>
+            <a href={allRss} rel="noopener" title="RSS">
+              <Icon icon="rss" classes="text-muted small" />
+            </a>
+            <link rel="alternate" type="application/atom+xml" href={allRss} />
+          </>
         )}
         {this.state.listingType == ListingType.Local && (
-          <a
-            href={`/feeds/local.xml?sort=${this.state.sort}`}
-            rel="noopener"
-            title="RSS"
-          >
-            <Icon icon="rss" classes="text-muted small" />
-          </a>
+          <>
+            <a href={localRss} rel="noopener" title="RSS">
+              <Icon icon="rss" classes="text-muted small" />
+            </a>
+            <link rel="alternate" type="application/atom+xml" href={localRss} />
+          </>
         )}
         {UserService.Instance.myUserInfo &&
           this.state.listingType == ListingType.Subscribed && (
-            <a
-              href={`/feeds/front/${UserService.Instance.auth}.xml?sort=${this.state.sort}`}
-              title="RSS"
-              rel="noopener"
-            >
-              <Icon icon="rss" classes="text-muted small" />
-            </a>
+            <>
+              <a href={frontRss} title="RSS" rel="noopener">
+                <Icon icon="rss" classes="text-muted small" />
+              </a>
+              <link
+                rel="alternate"
+                type="application/atom+xml"
+                href={frontRss}
+              />
+            </>
           )}
       </div>
     );
index b1f14e209897912da8bd6f953dbaf053c16b1308..470ef5eb29296c7f4907825a5aad88689f1bf413 100644 (file)
@@ -140,6 +140,7 @@ export class Inbox extends Component<any, InboxState> {
   }
 
   render() {
+    let inboxRss = `/feeds/inbox/${UserService.Instance.auth}.xml`;
     return (
       <div class="container">
         {this.state.loading ? (
@@ -156,13 +157,14 @@ export class Inbox extends Component<any, InboxState> {
               <h5 class="mb-2">
                 {i18n.t("inbox")}
                 <small>
-                  <a
-                    href={`/feeds/inbox/${UserService.Instance.auth}.xml`}
-                    title="RSS"
-                    rel="noopener"
-                  >
+                  <a href={inboxRss} title="RSS" rel="noopener">
                     <Icon icon="rss" classes="ml-2 text-muted small" />
                   </a>
+                  <link
+                    rel="alternate"
+                    type="application/atom+xml"
+                    href={inboxRss}
+                  />
                 </small>
               </h5>
               {this.state.replies.length +
index e36d0145c1af2fe7ee6023786c52d21a9ea04341..0f567d2c4230d6a3593f00e84f2892bd40ab6d3a 100644 (file)
@@ -335,6 +335,8 @@ export class Profile extends Component<any, ProfileState> {
   }
 
   selects() {
+    let profileRss = `/feeds/u/${this.state.userName}.xml?sort=${this.state.sort}`;
+
     return (
       <div className="mb-2">
         <span class="mr-3">{this.viewRadios()}</span>
@@ -344,13 +346,10 @@ export class Profile extends Component<any, ProfileState> {
           hideHot
           hideMostComments
         />
-        <a
-          href={`/feeds/u/${this.state.userName}.xml?sort=${this.state.sort}`}
-          rel="noopener"
-          title="RSS"
-        >
+        <a href={profileRss} rel="noopener" title="RSS">
           <Icon icon="rss" classes="text-muted small mx-2" />
         </a>
+        <link rel="alternate" type="application/atom+xml" href={profileRss} />
       </div>
     );
   }