January 25th
Adding an RSS widget to Hugo Sidebar
In WordPress, adding an RSS widget is quite straightforward with the default tools available. However, with Hugo, the process is a bit more involved. That said, my goal is to display my latest WordPress posts on Hugo, which doesn’t necessarily require using RSS format; directly calling the WordPress API would suffice. The methods, however, are similar to those used with RSS.
Add a Call Module to Hugo’s Sidebar Template
Method A: RSS Call
1 2 3 4 5 6 7 8 9 10 11
{{ $rssUrl := "https://news.lawtee.com/feed/" }} <!-- Replace with your RSS URL --> {{ $rss := resources.GetRemote $rssUrl }} {{ $items := $rss | transform.Unmarshal }} <h2>RSS</h2> <ul> {{ range first 7 $items.channel.item }} <li> <a href="{{ .link }}" target="_blank">{{ .title }}</a> </li> {{ end }} </ul>
Method B: WordPress API Call
1 2 3 4 5 6 7 8
{{ $url := "https://news.lawtee.com/wp-json/wp/v2/posts?per_page=7" }} <!-- Replace with your WordPress URL --> {{ $posts := getJSON $url }} <h2>Latest Posts</h2> <ul> {{ range $posts }} <li><a href="{{ .link }}" target="_blank">{{ .title.rendered }}</a></li> {{ end }} </ul>
Set Up Necessary CSS. For simplicity, I directly applied the CSS from another Hugo sidebar plugin,
archives
.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<section class="widget archives"> <div class="widget-icon"> {{ partial "helper/icon" "rss" }} </div> <h2 class="widget-title section-title"> <a href="https://news.lawtee.com/" target="_blank">News</a> </h2> <div class="widget-archive--list"> <ul> {{ range $posts }} <li><a href="{{ .link }}" target="_blank">{{ .title.rendered }}</a></li> {{ end }} </ul> </div> </section>
January 22
Preventing Credit Card Fraud
When I first started working, I frequently made purchases on foreign platforms such as Amazon, GoDaddy, and NameSilo, so I applied for several Visa and MasterCard credit cards. Since online transactions require entering the three-digit CVV code on the back of the card on the internet platform, there is a risk of card information being leaked. Although I pay great attention to credit card risk management, today my credit card still encountered a $0 fraud issue (no amount was paid, but the credit card information was definitely stolen).
The reason, I believe, is mainly that the “card lock” function of these credit card management programs is buried too deep. In the past, after foreign currency transactions, I would lock the card in the credit card APP. Later, because I changed my phone, I found it too cumbersome to install the bank APP, so I used the WeChat mini program instead of the bank APP for operations.
However, finding the “card lock” function in the mini program is not easy. I remember that I couldn’t find it several times before, so I gave up and used “transaction limit” instead of “card lock”. It wasn’t until I was defrauded at noon today that I started to seriously research where this “card lock” function is.
- China Construction Bank (CCB): The WeChat mini program does not have this function; it can only be operated in the security center of the CCB APP.
- Guangfa Bank: In the WeChat mini program, it is hidden in “Card Management - Card Detection Center”. Goodness, I really didn’t expect that.
- China Merchants Bank (CMB): The WeChat mini program does not have this function; it can only be operated in the security center of the CMB APP.
- CITIC Bank: In the WeChat mini program, click “Payment Settings” to see “One-Click Card Lock”. (The most convenient)
January 21
Watching Trump’s Inauguration Ceremony
Last night, I inexplicably watched the entire live broadcast of Trump’s inauguration ceremony, driven by curiosity that killed the cat. Throughout the event, I couldn’t help but feel a bit of a chill.
- Hierarchy Clearly Defined. The main venue at the Capitol was filled with dignitaries, essentially a gathering of nearly half of the world’s top 100 richest people. On the left side of the podium were Trump’s camp and wealthy supporters, while the right side featured several former Democratic presidents and prominent figures from the Democratic camp. The Chinese representatives were also placed on the right, subtly implying that China still has somewhat adversarial relations with Trump. In the adjacent hall, it seemed to be filled with mid-level career bureaucrats, who displayed much more discipline compared to the main venue, especially during the prayers by two pastors, where everyone bowed their heads and closed their eyes, appearing genuinely “faithful.” Meanwhile, in the main venue, many people didn’t seem to take this part seriously. Additionally, a stadium was specially arranged to accommodate the enthusiastic Mega supporters, but during the over two-hour live broadcast, the stadium was only shown a couple of times. This aligns with my impression of capitalism: the elite at the center, loyal henchmen on the periphery, and ordinary people left to fend for themselves on the sidelines. In reality, it’s all a show, and it wouldn’t be difficult to arrange for a few ordinary citizens to attend, but they chose not to. The elite could bring their entire families, while ordinary people weren’t even given a single representative spot.
- Professional Actors. American democracy indeed has its unique aspects; behind the scenes, it’s a life-and-death struggle, but on stage, everyone maintains a “gentlemanly demeanor.” In the main venue, everyone appeared calm and composed, especially on the Democratic side, where there was no sign of “defeat.” Even as Trump directly criticized the Democrats for their past four years of misdeeds, Clinton and Hillary managed to smile. As Trump systematically dismantled the Democrats’ previous policies, the Democratic leaders remained composed and unfazed, clearly seasoned actors. No wonder my teacher used to say, “Politics is all about showmanship.” On the other hand, a few Supreme Court justices appeared aloof and unmoved on the surface, but their expressions betrayed a hint of unease, suggesting negative feelings towards Trump, possibly related to the recent TikTok ban overturned by Trump’s executive order. It’s hard to remain neutral in the face of political conflicts.
- Comprehensive Contraction. The most important part of the inauguration ceremony was undoubtedly Trump’s speech. However, Trump spoke in a seemingly casual tone throughout, giving off a vibe of “saying the softest words while doing the toughest things.” Yet, looking at the actions Trump outlined, although the content was harsh, it revealed signs of the U.S. preparing for a comprehensive contraction. Whether it’s internal affairs like border control, gender reassignment, energy issues, urban crime crackdowns, and education and healthcare, or external matters like trade protectionism, seizing the Panama Canal, and naming the Gulf of Mexico, all indicate that this administration is truly lacking confidence. Perhaps the world order will be completely reshaped in these crucial four years.
January 16
Registering on Xiaohongshu
I always thought Xiaohongshu was a social platform tailored for the refined young female demographic. The occasional messages forwarded from Xiaohongshu on WeChat somewhat reinforced this perception. However, unexpectedly, on the eve of TikTok’s potential ban, Xiaohongshu suddenly gained widespread popularity. So, I registered an account using Gmail to check it out.
- This wave of traffic is incredibly valuable, and I hope Xiaohongshu can make good use of it. Between China and the U.S., especially among the general populace, the barriers deliberately erected by the elite class have almost completely isolated the two. Amid widespread ideological hostility, having so many Americans flock to a developing country’s online platform is indeed a stroke of extraordinary fortune.
- Many elite American media outlets, when introducing Xiaohongshu, use ideological labels like “Mao’s Quotations” and “Little Red Book” to scare the average American. While this might have some effect, any American who actually downloads and opens Xiaohongshu will see how baseless these insinuations are, further fueling their distrust of American media manipulation.
- From a national strategy perspective, the U.S. is clearly losing more in this wave. Banning TikTok won’t solve anything. The combination of live-streaming sales and short videos is a format that, globally, only China can truly excel in, as manufacturer live-streaming is the ultimate goal.
January 15
Setting Up My Own RSS Service with FreshRSS + FeedMe
Recently inspired by “Netizen Xiao Song,” I decided to set up my own RSS service, mainly to address mobile reading issues. As we all know, the currently popular Follow lacks a mobile client, and the mobile web version of Follow has somewhat reduced functionality, often requiring a switch to the desktop version, which is usually cumbersome. Additionally, since Follow currently only has an official web version, it’s unclear whether reverse proxying is allowed, and the service’s sustainability is questionable. Therefore, self-hosting an RSS service remains a reasonable solution. However, as long as Follow continues to operate, I will still use it on my PC browser.
This time, I used FreshRSS, which is more comprehensive in functionality compared to the previously deployed TinyRSS. It offers rich themes and supports PWA, allowing the webpage to be installed as a near-APP mobile application. However, after some consideration, I opted for a third-party app for a more aesthetically pleasing interface and smoother operation: FeedMe. Thanks to FreshRSS’s support for the GoogleReader API, after setting up FreshRSS on my server, I could easily transfer data to the FeedMe app, keeping both fully synchronized, even the content translated by plugins. This perfectly meets my current needs.
January 14
Setting Up Specific Information to Ignore Updates in Github Actions
Add the following content to the deployment template in the Workflow. For example, I mainly want to prevent automatic deployment when submitting webp images. Or, for minor modifications, you can include “webp” in the commit message to avoid automatic deployment.
|
|
Link Blog in a Static Site
Redowan’s article addressed a long-standing pain point for me—how to publish simple thoughts and updates on a static blog like Hugo, where most content might reference other sources. I initially considered using a Moments page within the article categories, but this method was still cumbersome, and I didn’t want these updates to clutter my RSS feed or disrupt the integrity of my blog posts. Therefore, I specifically set these “Moments” pages to only display two entries on the homepage. Unfortunately, this still didn’t fully meet my needs.
I went with a dead simple approach that has worked for me for the past 5 months:
- Detail view: Have a single markdown page dedicated to each year and add the links there.
- List view: Cluster the detail pages in a list view named “feed” .
Until this article suggested creating a separate page for updates. After considering the technical implementation, I finally went ahead and added this page.
Considering that I might often update this page using my phone, I set the file for this page in the Github repository as a browser shortcut for easy updates.