Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
18347 Lượt xem

 How can i rename a website page url?

e.g.:

www.example.com/page/page-abc to

www.example.com/page/page-xyz 


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

On version 10.0, I did it by editing value of "Key" field on the QWeb's form in backend. Go to Settings > Technical > User interface > Views. and search for the QWeb you want to change the URL by the it's t-name.

*Activate the developer mode first. 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Ensure you have activated developer mode in your General Settings, and go to the Website builder in Editor Mode. Navigate to the page you want to change its URL, click on Site > Under 'This Page' > Properties.

Change the URL and Save & Close.

Note that this was done on Odoo Online

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Erwin,

If you have this page built in XML it will have an ID. The XML ID refers to a class in a Python file which is inside an http.route and this determinates the page URL.An example for one of the pages I made. The XML:

 <template id="categoryselection">
            <t t-call="website.layout">
              <div id="wrap">
                <div class="container oe_website_sale">
                  <h1 class="mb32">Kies een categorie</h1>
                  <div class="row">
                    <form method="post" class="">
                        <div class="row bg-info" style="padding:15px;margin-top:30px;border-radius:15px;">
                          <div class="form-inline form-group">
                            <label for="afwerking" class="h4">Type afwerking</label>
			    <br />
                            <select id="afwerking" name="afwerking" class="form-control">
                              <t t-foreach="afwerkingen" t-as="afwerking">
                                <option t-att-value='afwerking.id'>
                                  <span t-field="afwerking.name" />
                                </option>
                              </t>
                            </select>
                          </div>
                        </div>
			<input type="submit" class='btn btn-primary pull-right' value='Bevestigen'/>
		   </form>
		  </div>
		</div>
	     </div>
	   </t>
	</template>

As you can see this has a template ID named 'categoryselection'. When you'd open the controller you will find a http route and a function which links to this page. In my example:

    @http.route(['/shop/categoryselection'], type='http', auth="public", website=True)
    //The function for this page
    def categoryselection(self, **post):
	cr, uid, context, pool = request.cr, request.uid, request.context, request.registry
        order = request.website.sale_get_order()
    //Lots of irrelevant code for you after this.

This @http.route is the name of the webpage, so this would for example be http://localhost:8069/shop/categoryselection. By changing this @http.route you can modify the page URL.

I hope this helps you enough.
Yenthe


Ảnh đại diện
Huỷ bỏ
Tác giả

No, sorry i don't understand what you mean. I just created a webpage trough frontend, and that needs a new url.

Hmm no idea about that sorry.. By the way you should know that its not a good idea to create new webpages etc through the frontend. If you ever update your base module or websites modules you will lose a lot of things due to it not being in the code..

Tác giả

The content pages you make always trough the front end. Looks to me this is how it is intended. The only problem is that if the page name has an error, we can't change it. At least i don't know how.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 25
606
2
thg 6 25
2220
3
thg 4 25
2474
1
thg 4 25
1653
1
thg 12 24
2231