-
Notifications
You must be signed in to change notification settings - Fork 0
/
rss-to-be-added-study.html
186 lines (183 loc) · 15.2 KB
/
rss-to-be-added-study.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2024-08-15 Thu 19:48 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>RSS can be added?</title>
<meta name="author" content="Vipul" />
<meta name="generator" content="Org Mode" />
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js"></script>
</head>
<body>
<div id="content" class="content">
<h1 class="title">RSS can be added?</h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#org2009083">1. Adding RSS Feed to a Static HTML GitHub Pages Setup</a>
<ul>
<li><a href="#org4a87307">1.1. <b>Create an RSS feed file</b> in your project directory, for example, <code>rss.xml</code>. This file will contain the RSS feed content.</a></li>
<li><a href="#orgcff2566">1.2. <b>Add the necessary RSS feed structure</b> to the <code>rss.xml</code> file. Here's a basic example:</a></li>
<li><a href="#org862970b">1.3. <b>Replace the placeholders</b> with your actual blog title, URL, description, and blog post details.</a></li>
<li><a href="#org0392691">1.4. <b>Add a link to the RSS feed</b> in your HTML <code><head></code> section, for example:</a></li>
<li><a href="#orgc613d4b">1.5. <b>Commit and push</b> the changes to your GitHub repository.</a></li>
<li><a href="#org239e452">1.6. <b>Verify the RSS feed</b> by visiting https://your-github-pages-url.github.io/rss.xml in your browser. You should see the XML content of your RSS feed.</a></li>
</ul>
</li>
<li><a href="#org4fa6e20">2. Steps to Integrate RSS Feed with org-publish</a>
<ul>
<li><a href="#org8302e3d">2.1. <b>Create an RSS Template</b>: First, you need to create a template for your RSS feed. This can be done by creating a new Org file (e.g., <code>rss.org</code>) in your project directory. The file should contain the necessary structure for an RSS feed.</a></li>
<li><a href="#orgb096958">2.2. <b>Define the RSS Feed in Your Org File</b>:</a></li>
<li><a href="#orgcaf6a8f">2.3. <b>Update Your Publishing Project</b>: In your <code>init.el</code> or Emacs config file, ensure your org-publish project is set up correctly. You can add a hook to call your RSS generation function after publishing:</a></li>
<li><a href="#org687701f">2.4. <b>Run the Publishing Command</b>: Use the command <code><C-c C-e P p></code> to publish your Org files. This will generate the HTML files and the RSS feed simultaneously.</a></li>
<li><a href="#orga95151f">2.5. <b>Verify the RSS Feed</b>: After publishing, check the <code>rss.xml</code> file in your publishing directory to ensure it has been updated with the latest blog posts.</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org2009083" class="outline-2">
<h2 id="org2009083"><span class="section-number-2">1.</span> Adding RSS Feed to a Static HTML GitHub Pages Setup</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org4a87307" class="outline-3">
<h3 id="org4a87307"><span class="section-number-3">1.1.</span> <b>Create an RSS feed file</b> in your project directory, for example, <code>rss.xml</code>. This file will contain the RSS feed content.</h3>
</div>
<div id="outline-container-orgcff2566" class="outline-3">
<h3 id="orgcff2566"><span class="section-number-3">1.2.</span> <b>Add the necessary RSS feed structure</b> to the <code>rss.xml</code> file. Here's a basic example:</h3>
<div class="outline-text-3" id="text-1-2">
<div class="org-src-container">
<pre class="src src-xml">
<span style="color: #595959;"><?</span><span style="color: #531ab6; font-weight: bold;">xml</span> <span style="color: #595959; font-style: italic;">version="1.0" encoding="UTF-8"</span><span style="color: #595959;">?></span>
<span style="color: #595959;"><</span><span style="color: #721045;">rss</span> <span style="color: #005e8b;">version</span>=<span style="color: #3548cf;">"2.0"</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">channel</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">title</span><span style="color: #595959;">></span>Your Blog Title<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">title</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">link</span><span style="color: #595959;">></span>https://your-github-pages-url.github.io<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">link</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">description</span><span style="color: #595959;">></span>Description of your blog<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">description</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">language</span><span style="color: #595959;">></span>en-US<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">language</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">item</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">title</span><span style="color: #595959;">></span>Blog Post 1 Title<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">title</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">link</span><span style="color: #595959;">></span>https://your-github-pages-url.github.io/blog-post-1<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">link</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">description</span><span style="color: #595959;">></span>Description of Blog Post 1<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">description</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #721045;">pubDate</span><span style="color: #595959;">></span>Mon, 14 Aug 2024 12:00:00 GMT<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">pubDate</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">item</span><span style="color: #595959;">></span>
<span style="color: #595959; font-style: italic;"><!-- </span><span style="color: #595959; font-style: italic;">Add more <item> elements for each blog post</span><span style="color: #595959; font-style: italic;"> --></span>
<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">channel</span><span style="color: #595959;">></span>
<span style="color: #595959;"><</span><span style="color: #595959;">/</span><span style="color: #721045;">rss</span><span style="color: #595959;">></span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org862970b" class="outline-3">
<h3 id="org862970b"><span class="section-number-3">1.3.</span> <b>Replace the placeholders</b> with your actual blog title, URL, description, and blog post details.</h3>
</div>
<div id="outline-container-org0392691" class="outline-3">
<h3 id="org0392691"><span class="section-number-3">1.4.</span> <b>Add a link to the RSS feed</b> in your HTML <code><head></code> section, for example:</h3>
<div class="outline-text-3" id="text-1-4">
<div class="org-src-container">
<pre class="src src-html"><<span style="color: #721045;">link</span> <span style="color: #005e8b;">rel</span>=<span style="color: #3548cf;">"alternate"</span> <span style="color: #005e8b;">type</span>=<span style="color: #3548cf;">"application/rss+xml"</span> <span style="color: #005e8b;">title</span>=<span style="color: #3548cf;">"RSS Feed"</span> <span style="color: #005e8b;">href</span>=<span style="color: #3548cf;">"/rss.xml"</span>>
</pre>
</div>
<p>
This will allow users to subscribe to your RSS feed.
</p>
</div>
</div>
<div id="outline-container-orgc613d4b" class="outline-3">
<h3 id="orgc613d4b"><span class="section-number-3">1.5.</span> <b>Commit and push</b> the changes to your GitHub repository.</h3>
</div>
<div id="outline-container-org239e452" class="outline-3">
<h3 id="org239e452"><span class="section-number-3">1.6.</span> <b>Verify the RSS feed</b> by visiting <a href="https://your-github-pages-url.github.io/rss.xml">https://your-github-pages-url.github.io/rss.xml</a> in your browser. You should see the XML content of your RSS feed.</h3>
<div class="outline-text-3" id="text-1-6">
<p>
That's it! Your static HTML GitHub Pages setup now includes an RSS feed. Users can subscribe to your RSS feed using various feed readers or browsers to stay updated with your blog posts.
Remember to update the rss.xml file whenever you add new blog posts or make changes to your existing posts[1].
</p>
</div>
</div>
</div>
<div id="outline-container-org4fa6e20" class="outline-2">
<h2 id="org4fa6e20"><span class="section-number-2">2.</span> Steps to Integrate RSS Feed with org-publish</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-org8302e3d" class="outline-3">
<h3 id="org8302e3d"><span class="section-number-3">2.1.</span> <b>Create an RSS Template</b>: First, you need to create a template for your RSS feed. This can be done by creating a new Org file (e.g., <code>rss.org</code>) in your project directory. The file should contain the necessary structure for an RSS feed.</h3>
</div>
<div id="outline-container-orgb096958" class="outline-3">
<h3 id="orgb096958"><span class="section-number-3">2.2.</span> <b>Define the RSS Feed in Your Org File</b>:</h3>
<div class="outline-text-3" id="text-2-2">
<p>
You can include a section in your Org file that will generate the RSS feed. Here’s an example of what that might look like:
</p>
<pre class="example" id="org7f22665">
#+TITLE: My Blog RSS Feed
#+EXPORT_FILE_NAME: rss.xml
#+OPTIONS: html-postamble:nil
#+BEGIN_SRC emacs-lisp
(defun my-generate-rss ()
(let ((rss-content "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\">\n<channel>\n"))
(posts (org-publish-get-project "my-org-files")))
(dolist (post posts)
(setq rss-content (concat rss-content
"<item>\n"
"<title>" (org-publish-find-title post) "</title>\n"
"<link>" (org-publish-find-link post) "</link>\n"
"<description>" (org-publish-find-description post) "</description>\n"
"<pubDate>" (format-time-string "%a, %d %b %Y %H:%M:%S GMT") "</pubDate>\n"
"</item>\n")))
(setq rss-content (concat rss-content "</channel>\n</rss>"))
(with-temp-file (expand-file-name "rss.xml" "~/destination/for/html/files/to/be/exported")
(insert rss-content))))
#+END_SRC
</pre>
</div>
</div>
<div id="outline-container-orgcaf6a8f" class="outline-3">
<h3 id="orgcaf6a8f"><span class="section-number-3">2.3.</span> <b>Update Your Publishing Project</b>: In your <code>init.el</code> or Emacs config file, ensure your org-publish project is set up correctly. You can add a hook to call your RSS generation function after publishing:</h3>
<div class="outline-text-3" id="text-2-3">
<div class="org-src-container">
<pre class="src src-emacs-lisp">(<span style="color: #531ab6; font-weight: bold;">setq</span> org-publish-project-alist
'((<span style="color: #3548cf;">"my-org-files"</span>
<span style="color: #8f0075; font-weight: bold;">:base-directory</span> <span style="color: #3548cf;">"~/path/to/where/this/repo/is/cloned"</span>
<span style="color: #8f0075; font-weight: bold;">:publishing-directory</span> <span style="color: #3548cf;">"~/destination/for/html/files/to/be/exported"</span>
<span style="color: #8f0075; font-weight: bold;">:recursive</span> t
<span style="color: #8f0075; font-weight: bold;">:publishing-function</span> org-html-publish-to-html
<span style="color: #8f0075; font-weight: bold;">:after-publish</span> my-generate-rss <span style="color: #595959; font-style: italic;">;; </span><span style="color: #595959; font-style: italic;">Call your RSS function here</span>
<span style="color: #8f0075; font-weight: bold;">:auto-sitemap</span> t
<span style="color: #8f0075; font-weight: bold;">:sitemap-filename</span> <span style="color: #3548cf;">"sitemap.org"</span>
<span style="color: #8f0075; font-weight: bold;">:sitemap-title</span> <span style="color: #3548cf;">"My Sitemap"</span>
<span style="color: #8f0075; font-weight: bold;">:sitemap-style</span> list)))
</pre>
</div>
</div>
</div>
<div id="outline-container-org687701f" class="outline-3">
<h3 id="org687701f"><span class="section-number-3">2.4.</span> <b>Run the Publishing Command</b>: Use the command <code><C-c C-e P p></code> to publish your Org files. This will generate the HTML files and the RSS feed simultaneously.</h3>
</div>
<div id="outline-container-orga95151f" class="outline-3">
<h3 id="orga95151f"><span class="section-number-3">2.5.</span> <b>Verify the RSS Feed</b>: After publishing, check the <code>rss.xml</code> file in your publishing directory to ensure it has been updated with the latest blog posts.</h3>
<div class="outline-text-3" id="text-2-5">
<p>
By following these steps, your RSS feed will be automatically updated whenever you publish your Org files, ensuring that your readers always have access to the latest content.
</p>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="date">Date: 2024-08-15 Thu 19:34</p>
<p class="author">Author: Vipul</p>
<p class="date">Created: 2024-08-15 Thu 19:48</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>