How do I get my blogdown blog on R-Bloggers? - r

I generate my blog using blogdown, but when I have tried to submit it to R-Bloggers it is not accepted because my feed returns the following error:
This XML document is invalid, likely due to invalid characters.
XML error: Undeclared entity error at line 6, column 35
Apparently the feed for my website does not contain the full RSS content. How do I get it to hold all the content?

In the Hugo documentation (https://gohugo.io/templates/rss/), they provide the embedded RSS xml file that currently "ships with" Hugo. According to the docs, a section’s RSS will be rendered at /SECTION/index.xml (e.g., http://spf13.com/project/index.xml). So for your posts, it would be http://spf13.com/post/index.xml.
The key line in the built-in RSS xml file is this one:
<description>{{ .Summary | html }}</description>
From this discussion (https://discourse.gohugo.io/t/full-text-rss-feed/8368/2), it looks like you want to change what goes in the description tags from .Summary to .Content. Here is an example blog post where the author implemented this change: https://randomgeekery.org/2017/09/15/full-content-hugo-feeds/
So you would change that one line in the Hugo RSS xml to:
<description>{{ .Content | html }}</description>
The full rss.xml file should live in your layouts/ folder, with that one line changed.
It does look like there are other options you could test, like working with output formats in your config.toml file (https://github.com/gcushen/hugo-academic/issues/346; https://gohugo.io/templates/output-formats/) and referencing your RSS in your header.html (https://gohugo.io/templates/rss/), but changing .Summary to .Content should address your issue.

This seemed to work for me...
create a directory in your layouts folder called tags. So you should have this folder structure:
<your_base_directory>/layouts/tags
(this isn't the layouts directory in the themes directory).
Then create a new file:
<your_base_directory>/layouts/tags/rss.xml
Then paste this into your newly created rss.xml

Related

How can I explicitly link to the `index.html` file in a Quarto Book

I'm used to using bookdown to create books that don't have to be hosted on a webserver to work properly. I usually keep the _book directory and make it available on a shared drive with my team so that when my users click a link from somewhere else, they are taken into the book that lives on the OS file system.
With quarto, just about everything works similar to bookdown in this regard. However, when I try to navigate to the index.html landing page, it seems that quarto is expecting this to live on a webserver so the links don't go to book-name/index.html, they instead go to book-name/. Which throws an error when I'm using this in the file system.
Is there a way to ensure the link to the index page in my table of contents explicitly refers to book-name/index.html?
Here is the link that appears when I hover over the bookdown index link in the table of contents.
Here is the link that appears when I hover over the quarto index link in the table of contents.
But everything else in quarto links explicitly to the page it needs.
Also stumbled across this one. I don't think it's desired behavior. Solved it by setting the link manually in the sidebar.
Simply add the following key to book: in the _book.yml file:
book:
.
.
sidebar:
title: "<a href='/index.html'>Your Book Title</a>"

TOC not displaying in Blogdown post (Hugo theme Even)

I have added a new post to my site made using blogdown. Despite the presence of toc: yes in my YAML, the table of contents is not displaying on the rendered webpage. I've also tried adding:
output:
blogdown::html_page:
toc: yes
which doesn't solve the problem either. I'm currently using the Even theme (Hugo), and in the .config file, I also have toc: yes present.
I checked out this post, but I wasn't able to find the files they are referencing, nor those particular lines of code. Also my issue is with new posts, not the home page.
Does anyone know what the problem might be?
EDIT: I can see in my index.html file (generated from index.Rmd) that the code for a toc is present. For some reason, it's not being rendered on the page?
TL;DR Solution: to get the table of contents to show in the Even theme, your posts must render to the .markdown format instead of .html format. In order to make this happen, you simple use the .Rmarkdown file extension when creating the post instead of .Rmd. Now, when you use blogdown::serve_site(), your post will use the output format .markdown instead of .html. Your post will now render with a beautiful table of contents.
A note for latex math mode users: when typing in your .Rmarkdown document, you will now have to escape your $'s and \'s. So for example, $\le 0.2$
will have to be typed as \$\\le 0.2\$.
I hope this overly elaborate problem and solution is helpful to someone!
I figured out a workaround for this.
First, I'm not sure how to provide a reproducible example in this context, but I can say that if you open an RStudio project, run blogdown::new_site(theme = "olOwOlo/hugo-theme-even"), add a New Post using the Addin dropdown menu, add some headings to your post, make toc:true, use Serve Site from the Addin menu. You will see your post working fine in every respect - only it will be missing the table of contents.
Workaround:
I don't know why, but it appears that the table of contents will show if I keep a copy of the post in .md format, and delete the .html document. The default behavior seems to use the .html document if it is present; failing that, it will use the .md document.
To keep a copy of the post in .md format, use the following code in the YAML of your .Rmd document:
output:
blogdown::html_page:
keep_md: yes
Serve the site, delete the .html document (but keep the .md document), and the table of contents appears in all of its glory (you may have to actually knit the file to get the .md).
I don't know why this works...I've seen elsewhere (although I can't seem to find the post again) that some hugo themes don't play nicely with .html files, and prefer .md files, and that appears to be the case for the Even theme.
In sum: My workaround for now is thus to work on my posts, and when I'm done, knit the document with the option above, delete the .html file, and be on my way.
Caveat: blogdown seems to automatically re-render all the old posts when using Serve Site. According to this stack answer, Serve Site should only render documents that have undergone changes. Regardless, the old posts are most definitely being re-rendered, even when working on an unrelated post. I'm not sure if this behavior is attributable to blogdown per se, or the RStudio project.
I tried going to Tools -> Project Options -> Build Tools, and unchecking the boxes "Preview site when building", yet the behavior persists. Which means I will have to continuously delete these new .html files for all old posts every time a I make a change to any other file. Currently I only have one post, so not a big deal...yet.
If someone knows of a solution to this caveat, I would be extremely grateful. If I find one, I will edit this question and add it.
EDIT: it appears that blogdown will re-render the old post if there is no .html document present. Otherwise, it does not re-render it.
EDIT 2: Aha! According to the answer to this question, simply changing the file extension of the blog post from .Rmd to .Rmarkdown will produce a .markdown document instead of a .html document.

My CSS works in the inline section but not as an external stylesheet

I am currently trying to use CSS to stylize my application in Apex 5. The problem I am having is that when I write my CSS code in the "inline" section of any page in the application, then the CSS code works, but if I write the CSS code on Notepad and then upload the file and reference the file within my application, then the CSS code does not work. I have written several lines of CSS code, so I'll just post one small section of it as a sample so that you all can see my format:
body{
font: bold 12px/16px "Times New Roman";
}
I have uploaded the file in the Static Application Files section of the Shared Components page of the application. I have then tried referencing the file in different places, such as at the page level and user interface level, but nothing has worked so far. I'm very new to CSS, so any insight would be greatly appreciated. Thank you in advance!
After uploading the file have to be displayed in the list of static files. The list of files have a column Reference, which contain a string like this: #APP_IMAGES#test.css. Copy this string and put it, for example, on the page in the section CSS - File URLs. This should work.
Then make sure that file reference works. Open your page and take a look on a list of CSS files. The same functionality is present in all browsers, but it is accessible by different ways. In IE:
Press F12.
Open Network tab.
Press "Enable network traffic capturing" (a green triangle in the left top corner).
Reload the page. A list of files appears.
Find your file in a list:
If the file is not present, then you copied an incorrect link, or you copied it into an incorrect place, etc.
If the file is present, normally it should have status 200 (the Result column). If a status is not 200, there could be a lot of reasons (depending on the status).
If the file is present with the status 200, your CSS property doesn't work, because it is overridden with another CSS. To define with which one, go to the Dom Explorer tab.
You can try this approach:
On server, go to ORACHE_HOME/apex/images/css (path can be different, but you can find it by .css extension)
Put you file here
Id editor, in page properties, go to the CSS -> File URLs section
Write path like this: /i/css/new.css (i - in general, alias for your images directory)

Include dygraphs in Jekyll-run site from R

Is it possible to include dygraphs chart or some of other js-object supported by htmlwidgets.org to Jekyll-run site from R?
I've tried different variants (Rmd -> Md or Rmd -> html) with no success. The best outcome I have, dyghraphs is included into html-code but doesn't show up on the page (example: http://quantviews.github.io/dygraphs-test/).
Is there any working examples of Jekyll-run site with dygraphs included from Rmd-files?
I think Jekyll is skipping the "libs" directory that's in your _posts folder. (I'm pretty sure it's designed not to process sub directories under "_posts".) The fix is to move the libs folder up and then update the links to point to the new location. For example:
Move the "_posts/libs" folder up one directory so it's sitting next to "_posts".
Add a "/" to the front of the URLs for all the <script src="libs/... links so they call from the docroot. Should look like: <script src="/libs/....
Add a "/" to the front of the URLs for all the <link href="libs/... links so they call from the docroot. Should look like: <link href="/libs/.....
That's it for the main fix. But, there is another bug too. In the _posts/2015-05-15-dygraphs-test.html file, there is a call to:
<script src="libs/dygraphs-binding-0.4.1/dygraphs.js"></script>
But the version 'dygraphs-binding' version in your current libs directory is 0.4.3. I tried just changing the directory name and that worked for me. (i.e. "/libs/dygraphs-binding-0.4.3/dygraphs.js" becomes "libs/dygraphs-binding-0.4.1/dygraphs.js"). It would probably be better to actually line everything up, but that will at least get you working.
my solution:
render with rmarkdown::html_output, copy dygraph dependencies from header
create a new jekyll layout in _layouts/ with the dygraphs dependencies (changing libs to /libs as mentioned before)
run rmarkdown again, this time with rmarkdown::html_fragment to generate html without header
copy html fragment to _includes/
create a new blog post using layout specified in [2]
include html fragment in body of blog post using {% include html_fragment.html %}

Exactly the same content atom feed format in .asp and .aspx: One working, one is not. Why?

I am currently trying to implement an atom feed for my Umbraco website (The question is not Umbraco specific, please don't tag with 'Umbraco'). For testing purposes I've copied an atom feed that I found on the web (please don't tell anybody, it's probably illegal) and pasted the content inside a page template. The resulting output is an .aspx - page, which contains nothing but the pasted code:
Not working on aspx - page
As you can see, it is not working, the feed is shows as text, no subscribe options and the like. Accessing the feed with a C# atom API yields an exception, saying the feed type cannot be determined.
Now I've taken the exact same content and pasted it inside another file, this time with the ending .asp, which you can see here:
Working on asp - page
It works. It also works when I rename the file ending to .htm, .html or .xml.
My questions (I've got two) (thanks in advance):
a) Are atom feeds generally not working when the file ending is .aspx?
b) How can I provide an atom feed on an .aspx site, when I can't change the file ending?
Ok, found it thanks to this question:
SO Thread
There were blank lines on top of the document in the .aspx file...

Resources