Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RSS feed to blog #37

Open
cmeeren opened this issue Apr 21, 2019 · 7 comments
Open

Add RSS feed to blog #37

cmeeren opened this issue Apr 21, 2019 · 7 comments

Comments

@cmeeren
Copy link

cmeeren commented Apr 21, 2019

Not sure if this is the right place, but it would be great to have an RSS feed or similar for the Fable blog.

@alfonsogarciacaro
Copy link
Member

The blog is published from fable-compiler.github.io so probably it should be done there. Anyways, I have no idea about how to make the RSS feed so this feature should come through a PR (in a way that updates are done automatically) :)

@cmeeren
Copy link
Author

cmeeren commented Apr 22, 2019

Ok, I don't know either, so I'll leave this for someone else. :)

By the way, I think you can move issues between repos now. Should be a "Transfer issue (beta)" link at the bottom of the right sidebar. So you can move it to the correct repo if you want.

@xdaDaveShaw
Copy link

I cloned the repo to look at this the other day, but didn't make any progress... now I'm not the only one needing this I might take another look tonight

@alfonsogarciacaro alfonsogarciacaro transferred this issue from fable-compiler/Fable Apr 23, 2019
@alfonsogarciacaro
Copy link
Member

That'd be awesome @xdaDaveShaw. I do need to automatize a bit more the blogs (e.g. the index is still updated manually) so let me know if you need something and I can add it to the build script:

let renderBlog() =
let reg = Regex(@"^\s*-\s*title\s*:(.+)\n\s*-\s*subtitle\s*:(.+)\n")
let pageTitle, header, subheader = "Fable Blog", "Blog", "Read about latest Fable news"
renderMarkdownFrom pageTitle Navbar.Blog header subheader "blog"
(Node.path.join(Paths.BlogDir, "index.md")) (Node.path.join(Paths.DeployDir, "blog", "index.html"))
let blogFiles = Node.fs.readdirSync(!^Paths.BlogDir)
for blog in blogFiles |> Seq.filter (fun x -> x.EndsWith(".md")) do
let text = Node.fs.readFileSync(Node.path.join(Paths.BlogDir, blog)).toString()
let m = reg.Match(text)
let header, subheader, text =
if m.Success
then m.Groups.[1].Value.Trim(), m.Groups.[2].Value.Trim(), text.Substring(m.Index + m.Length)
else header, subheader, text
let targetPath = Node.path.join(Paths.DeployDir, "blog", blog.Replace(".md", ".html"))
renderMarkdown pageTitle Navbar.Blog header subheader "blog" targetPath text
printfn "Blog generated"
let renderHomePage() =
render
{ Title = "Fable: JavaScript you can be proud of!"
TargetPath = Node.path.join(Paths.DeployDir, "index.html")
NavbarActivePage = Navbar.Home
RenderBody = HomePage.renderBody }
printfn "Home page generated"

@xdaDaveShaw
Copy link

Thanks, I'm starting from there...

It still needs a bit of work, I need to refactor the code a little, and I can't get the dates in the right format.
I might do another PR to update the latest version to see if there's help there.

Current WIP is here: https://github.com/xdaDaveShaw/fable-compiler.github.io/tree/feed

I was trying to do it in a way to not alter your workflow of publishing posts.

Once I get it finished a send a PR, and we can iterate on the workflow

@xdaDaveShaw
Copy link

It looks like I need to add RFC-1123 formatting (DateTime.ToString("r")) to Fable to get this to work - I'm sure there's a workaround, but it eludes me at the moment - How do I call date.toUtcString on an object?

I'll create a PR for the Fable changes to get this added, and then I'll have to update this Repo to Fable 2.2.* as part of this work (or would a separate PR be better?)

@xdaDaveShaw
Copy link

OK, I'm really struggling with Dates...

JavaScript has .toUTCString but that converts from your current local to UTC, so calling that on my +0100 machine, means I get a date for yesterday.

I think we might need to change the workflow to enable an RSS Feed.

Maybe using a format like Jekyll does at the top of the posts with the date it was published in UTC Format, instead of/as well as typing it into the Index.md

Or a real poor mans version is just to manually update a feed.xml file :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants