Can't change post author with blogdown - r

I have successfully used the blogdown R package for a few months now for the blog of my team at work, until the moment I was not the only author anymore.
At that point I realized that the author's name specified in the blog post was not really taken into account. Instead, it was read by default from the config.toml.
The relevant part of my config.toml looks like this:
[Author]
name = "Darth Vader"
profile = "https://linkedin.com/in/darthvader/"
And the top part of the specific blog post is structured like follows:
---
title: A new hope
author: Luke Skywalker
date: '2017-10-10'
---
However, it is Darth Vader that invariably appears as the post author, regardless of what the author: field contains. If I leave the config.toml's field empty, then no name at all appears once the .Rmd is rendered.
Am I doing something wrong?

Copying from the discussion under the main post:
I contacted the theme maintainer and the bug is now gone! https://github.com/jbub/ghostwriter/commit/d40349f7692bd3a0b2e99798dba6d6b87c10d12c

Related

Hugo: don't publish future posts

I have a site that I am building with hugo and deploying on Netlify with the standard hugo command. I have a post with the following frontmatter:
---
weight: 99
title: foobar
date: 2022-5-12T1:00:00-07:00
---
Even though date is in the future (as of this writing) the post is being built along with the rest of the site and is visible.
According to this post it shouldn't be visible because date is in the future. I haven't done any date configuration in my config.toml file, but just to check, I tried changing date to publishDate:
---
weight: 99
title: foobar
publishDate: 2022-5-12T1:00:00-07:00
---
I even tried including both date and publishDate, but nothing I've tried so far has had the desired effect. The post still shows up even though the date is in the future.
Again, on Netlify the site is being build with the hugo command, so the --buildFuture option is not included. This is also an issue when I view my site locally with the hugo server command. Is there anything else I should check for or something I'm doing wrong?
I found the problem. Turns out the date format is pickier than I thought. 2022-5-12T1:00:00-07:00 wasn't being recognized as a valid date, so it defaulted to January 1, 0001. Once I changed the date to 2022-05-12T1:00:00-07:00 (making the month two digits instead of one) it recognized the correct date and worked as expected.

Internal Hyperlinks

I have recently written a blog post using blogdown through RStudio, and I am trying to use internal hyperlinks within the post. Specifically, I am trying to link a 'string of text' to another 'string of text' in a different section of the script.
For instance, I created a blog post that defines some functions in the first section of the document, and my goal was to link those function names to the section of the document where I give examples on using that specific function.
To clarify, it works great when I knit my Rmd; however, it stops working once the blog is posted. Although the function names still appear to be hyperlinked, you are actually brought to the home page of my website, and not the example section of the post which is what I want. If anyone could provide any suggestions or resources I would really appreciate it! Thank you!!
Please find the blog post here (with the internal hyperlinks not working) http://sarahrsalter.com/blog/2018-02-18-dplyr/.
Here is the Rmd code:
+ [**select()**](#Select): evaluates a subset of specified variables
(columns) within a dataset.
## II) Select Functions <a id="Select"></a>
### Example 1

add 'Working Papers' Section (within publications) to hugo-academic site

I am using R blogdown package to create my personal website. I am basing it on the hugo-academic theme (code here)
I would like to add a "working papers" section to the publications.
In my discipline Economics we normally have
"working papers" (pdf is available)
"work in progress" (no pdf yet)
"publications"
How can I add that?
Do I need to change the internals of the hugo-academic theme? (I am an R user/programmer with little webdev knowledge)
I posted as github issue: hugo-academic/issues/416
Edit: I would also like to have the "Selected Publications" section disapear. I could not do that even after setting selected = false on all the publications .md files. This was asked in github issue: hugo-academic/issues/417
Edit2: I would also like to add a new "Work in progress" section (hugo-academic/issues/418).
Edit3: #jsb answer bellow does not alter how the papers are grouped by type (working paper, work in progress, peer-reviewd), which is my main concern. But it does add these cathegories to the metadata (and fixes question two).
They way I understand it now, I would have to add new widgets for "Working Papers" and "Work in Progress". I think I could create them by analogy from the existing widgets.
Where in the code are the widgets are defined?
Answering your first question: I don't think this is possible in the current version of the academic theme. However, what you can do, is to use the publication types that are defined in the config.toml file. In this file, there is a list of publication types that are used to categorize publications. It includes a type called "work in progress". You can also add your own publication types to this list, like so:
publication_types = [
'Uncategorized', # 0
'Conference proceedings', # 1
'Journal', # 2
'Work in progress', # 3
'Technical report', # 4
'Book', # 5
'Book chapter', # 6
'working paper', # 7
'peer-reviewed' # 8
]
For each publication Markdown file, change the publication types parameter to the wanted type, e.g. publication_types = ["7"] for a working paper. The effect is visible when you click on the "Details" link for a publication listed under "Publications" or "Selected Publications".
Answering your second question: to delete a section, delete the corresponding Markdown file from the "content/home" folder. Alternatively, move the unwanted Markdown file to a new folder, e.g. "_not_used", in the "content" folder.
Update: OP found the answer himself, and I am putting it here for future reference:
I found the solution, all I had to do was duplicate the
publications.md file, naming it publications_working_papers.md,
publications_book_chapters.md for instance. In each file use widget =
"publications" and adjust the publication_type accordingly. And also the
weight to determine the order.
Not sure if this is still relevant #lucasmation, but for 'Selected Publications' to be turned off, you'd have to go to contents>home>publications_selected.md and set the widget to be false. Hope this helps.
# Selected Publications widget.
# This widget displays publications from `content/publication/` which have
# `selected = true` in their `+++` front matter.
widget = "publications_selected"
active = false
date = 2012-01-01T00:00:00
I managed to do this in the current hugo-academic setup by using "featured" widgets. In my case I wanted a section for books, one for journal articles and one for working papers.
In the home folder, I made a copy of featured.md and named it working-papers.md. I then renamed the original featured.md to books.md.
From there, I opened books.md, set weight: to 20, changed the title: to Book and set filters: publication_type: to "5".
Next, I opened the new working-papers.md file, set weight: to 30, changed title: to Working Papers and set filters: publication_type: to "3".
Then I renamed publications.md to articles.md, opened the file, set weight: to 25, title: to Journal Articles and set exclude_featured: to true. This ensures that the books and working papers that I want to include in the "featured" widgets do not also appear in my "Journal Articles" section.
Finally, I set featured: to true in the index.md files for my book and working papers in content\publication to populate the new "Book" and "Working Papers" featured widgets.
This gives me three consecutive sections on my website listing my book, journal articles and working papers.
I initially tried it the way you suggested in your note (copying and renaming the publications.md file). You can still do it like this, but the current setup uses the pages widget for publications.md. So instead of changing the widget type, you have to change page_type: to publication and then set publication_type: to whatever type of publication you want to include on that page. This worked OK but strange things happened when I clicked on the "See All Publications" link at the bottom of my "Journal Articles" section, so I ended up using the featured widgets instead.

Jekyll date permalink different from post dat

I imported my blog from wordpress into jekyll, but the permanent links are inconsistent. Here's one example:
my post (full file)
wordpress_url: http://fabiopereira.me/blog/2011/10/19/tw-ssc-deep-sea-fishing/
date: '2011-10-19 05:09:57 +1100'
date_gmt: '2011-10-19 12:09:57 +1100'
is generating the link
blog/2011/10/18/tw-ssc-deep-sea-fishing/
The problem is the date
Instead of 2011/10/19/ in the url, it's generating 2011/10/18/
For reference
my jekyll _config.yml
permalink: /blog/:year/:month/:day/:title
timezone: Asia/Sydney # eg. Asia/Kathmandu
locale: en_AU # eg. en_us
Any help is appreciated, thanks.
I don't know think this post is on-topic for Stack Overflow, and should probably be migrated to SuperUser or somewhere more appropriate.
Nevertheless, I see two possible problems:
date_gmt
Your post file contains both date and date_gmt. I'm not sure you want to set both. You probably only want to read date_gmt, rather than writing it.
Even if you do write it, you probably want to make sure your date_gmt doesn't have a local time offset (in your example above, it has the same +11 offset that your date has).
Timezone
I suspect that Jekyll doesn't complain when you set a timezone that doesn't exist. I suspect you'll get the same results with "Fiction/Utopia" as you do for "Asia/Sydney" (which I don't think is one of the standard locations in the database). Try "Australia/Sydney" instead (or maybe "Pacific/Sydney", I'm on mobile and I don't have the list to hand right now).
Good luck!

Wordpress template file author.php. How to get author ID?

Question is about Wordpress template file author.php.
At author.php, I need to output author ID, to get more info, but I cant do that. Maybe someone can help ?
Example:
http://www.domain.com/?author=1
Need to output Author ID: 1
http://www.domain.com/?author=2
Need to output Author ID 2
Have a look at the Setting Up for Author Information section of the Author Templates section of the codex. Once you've initialised $curauth you should be able to use $curauth->ID.

Resources