Hugo: don't publish future posts - web-deployment

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.

Related

How to display links in storybook next to title?

I'm trying to show 'copy' links when user hovers on heading:
In storybook ducumentation sometimes it works:
https://storybook.js.org/docs/react/writing-docs/mdx#documentation-only-mdx
And sometimes not:
https://storybook.js.org/addons/#storybook/addon-links
How do I enable them? What I've tried - I've copied code from storybook's github - I thought that top links somehow get mapped later to the headings, but no luck so far
- [Basic example](#basic-example)
- [MDX-Flavored CSF](#mdx-flavored-csf)
## Basic example
## MDX-Flavored CSF
do I need any addons to handle that?
The problem is that headings ids are not generated by remark-slug package here -- in HeaderMdx it doesn't go into if condition because no id was provided and function returns regular <Header> instead of <HeaderWithOcticonAhchor>
Based on this thread this was broken after 6.4.19 and fix was pushed into 7.0.0
So solutions are:
downgrade, though its not obvious to me how to do that yet
upgrade to 7.0.0 (which is in alpha18 as of now)
postinstall patching of latest 6.5.0

qTranslate-X issue with WP post date month name in Ukrainian

I am using 3 languages: Ukrainian (default), English and Russian. The plug-in works perfectly, but the name of the month (in the date of comment or post) looks like �������. Everything else (including calendar in the widget) are translated correctly.
I have changed the text encoding in the browser to try to find out if it is the encoding issue and yes - the month's name is in KOI8-U - somehow.
Wordpress 4.9.4
qTranslate: 3.4.6.8
I found the answer which works for me:
See DaniilKZ's answer here
Here is a quote:
Add the code to the function.php:
remove_filter('get_the_time',
'qtranxf_timeFromPostForCurrentLanguage',0,3);
remove_filter('get_the_date',
'qtranxf_dateFromPostForCurrentLanguage',0,3);
remove_filter('get_the_modified_date',
'qtranxf_dateModifiedFromPostForCurrentLanguage',0,2);

Can't change post author with blogdown

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

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!

WP: Page Not Found

I am using WP-3.3.2 and had created a website eyepractice my script gets month and year from url and then shows calendar for that month and year but when I integrate with Wp it only work for year 2012 and if I use http://www.eyepractice.ca/optometris/guelph/?month=1&year=2013 it shows Page Not Found however I have already created a Page named guelph from Wp admin. I searched whole project for 2012 but it is not hard coded.
This is a REALLY old question, but I came across it while looking for solution to the exact same problem, so I will leave an answer here.
I used a calendar creation script based on this link:
http://davidwalsh.name/php-event-calendar
In Wordpress apparently using 'year' and 'month' as $_GET variables conflicts with Wordpress internal query variable handling, so the calendar only worked for current year for me and threw a 'page not found' error on the next year.
The solution was simple. As #janw suggested, change the parameter names. In the script wherever $_GET variable is called 'month' or 'year', change it to something else like 'cal_month' or 'cal_year'. Works like a charm.

Resources