How to publish a sitemap.xml to my website? - go

I did not have programming background and I learned to code completely by Google search so please excuse me if the question is not totally clear. I tried to search a this issue but could not find an answer.
I have built a website with React + Golang (Beego framework). Now I am trying to add a sitemap.xml to my website so that when people go to mywebsite.com/sitemap.xml, they will see the sitemap. I already generated the xml file but I am not sure where to put it.
I tried to set a URL in Golang as /sitemap.xml but Golang (Beego) does not render xml file and shows an error. I can put that file into folder static and access that file at mywebsite.com/static/sitemap.xml but I want it to be mywebsite.com/sitemap.xml.
I think I am trying to do it the wrong way. Really appreciate any advice.

Related

Sphinx- how to remove folder names/sub directories and file extensions from URL?

I do my best to read and understand sphinx documentation but unfortunately I can't at this point :/. Also read many questions and answers on stackoverflow.
I want to remove all folder and sub folder names when a user clicks on a section on my page. How can I achieve this?
As an example I want to turn the URL's from these:
http://127.0.0.1:5550/project/august/access-points.html
http://127.0.0.1:5550/project/august/5G.html
To these:
http://127.0.0.1:5550/access-points
http://127.0.0.1:5550/5G
...I am new to sphinx, Read the Docs and web development. I will host my website on Read the Docs after that.
So I appreciate if you could explain your suggestions in a way that I can digest

create-react-app: where do I put dynamically uploaded images?

Hi I'm working with create-react-app, i've setup a file upload that allows images to be sent to the backend and saved locally (to the projects build directory). I'm able to dynamically reference images via localhost:4000/image.png so that already works (ie: i have a blog that lets me upload images that I later access via a blogList).
However i figured this probably isn't the best place to dynamically upload images to. I've read the docs on create-react-app and both the locations that mention images dont seem to work for my use case, i feel like im definitely doing something wrong but im not sure what.
docs im referring to:
Says use "import" however im loading dynamically so i cant see how this would work?
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-images-fonts-and-files
says use public, however wouldnt that require a rebuild? since im loading dynamically that isnt possible: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#when-to-use-the-public-folder
NOTE: i have a image uploader and backend working fine it works already using the /build directory. i can upload and dynamically reference images. I'm just looking for best practices for doing something like this. Thanks!
(if you mention "just use nginx" could you please elaborate on the implementation a little)
As a learner I struggled with this problem and tried different approaches once a while ago. For rarely used assets, using /public for client could be useful but I have an app where clients upload images and manage them. Like you, I did not like those approaches and ended up with this setup.
Create a /public directory on backend and upload images to /public/images
Serve /public directory with Express statically.
Use dynamic path variable (via a config setup) for image paths. http://localhost:backend_port/public/images for development and /public/images for production.
I don't know this is the best approach but it worked for me. Beside being best approach when I upload images before that setup CRA was refreshing (hot reloading) my app after each image upload.

How would I generate a LRD & ludocid for google search

I've been digging all around the web and can't figure out how to generate a LRD and ludocid. I'm trying to create a simple review link generator but can't seem to get anything of it. I know the procedure of viewing page source etc but I'm trying to make it so it automatically gets it from the input..
This blog post explains both: https://www.theedesign.com/blog/2016/how-to-create-a-google-review-url-with-the-new-g-layout

How to upload files to Soundcloud using Codeigniter?

I am building an application that would upload audio on SoundCloud and get the URL of the uploaded track using Codeigniter.
I need to know how to upload the file to SoundCloud.
How do I do it? I have not used API thing before and I don't find a proper tutorial or a guide to how to upload it. So if anybody can help me with this, please answer my question here.
You should try the SoundCloud CodeIgniter Library, from GitHub. I have never used it, but I do have an upcoming project that will use SoundCloud, so for now this is all I can do;
https://github.com/benedmunds/CodeIgniter-Soundcloud-Library

Using Javascript to download file in Wicket

I am confused on how to do this.. Currently I am implementing an automatic download using Javascript:
target.appendJavaScript("location.href='"+ "./Access.xls" + "';");
This doesn't work.. What is the proper way to trigger an automatic download and how do I properly set the url? I am not too familiar with Javascript but trying to implement this. The file is in the root of the project.. but it tells me it is not found.
Also, when the user downloads it, I would like to then delete it right away after it is downloaded using Javascript, how can I do this? I am using Javascript because I am calling this file within an ajax method.
Thanks!
The best way to get access to that resource, you should use a ResourceReference as explained here. To get the url of a ResourceReference use:
RequestCycle#urlFor(ResourceReference, PageParameters)
However, I don't understand what you need regarding deletion of the file once downloaded. If your file is contained in the jar/war of your project, I don't believe it can be deleted from inside the web app. You could block access to it once it's downloaded however, if that makes sense. Not sure what you're trying to achieve here.

Resources